Npm: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Created page with "= Useful commands = List the packages at depth npm list --depth 0"
 
No edit summary
Line 2: Line 2:
List the packages at depth
List the packages at depth
  npm list --depth 0
  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
<source>
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 };
</source>

Revision as of 06:00, 5 November 2019

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 };