Quick start node
Create Empty folder on desktop
Open with VScode and open terminal
Use the following commands
Create node
npm init -y
install dependencies
npm i express nodemon
Make changes to the package.json file. Like if you are using nodemon, add what is missing under the scripts dictionary
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
"start": "node index.js",
"dev": "nodemon index.js",
Make a file name index.js (this is your main server with node)
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(Server running on http://localhost:${port});
});
start node
npm run start
or
npm run dev
Last updated