Npm

From bibbleWiki
Revision as of 06:00, 5 November 2019 by Iwiseman (talk | contribs)
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 };