how to import npm module
snippet in javascript

how to import npm module

user1176

import foo from 'bar';
//or
const bar = require('foo');

how to import npm packages in node.js?

user4351

//in cmd prompt: 
//npm i <package-name>

//defining package in code: 
const package = require("package-name")