Npm

From bibbleWiki
Jump to navigation Jump to search

Useful commands

List the packages at depth

npm list --depth 0

New Babel 7 Project

 mkdir project1
 npm init
 npm install --save-dev @babel/core
 npm install --save-dev @babel/cli
 npm install --save-dev @babel/preset-env
Create in the root .babel.rc
 {
   "presets": ["@babel/preset-env"]
 }

Create src/index.js

 import express from "express";
 const app = express();
 
 app.use("/", (req, res) => {
   res.status(200).send("Hello World");
 });
 
 app.listen(3000);
 
 console.log("Server running at http://localhost:3000/");
 
 export { app as default };