How to set up server-side using express & node

ehdtlaos

Edrick Ee

Posted on August 13, 2021

How to set up server-side using express & node
  1. Create your empty repo

  2. Create index.js file (where express is going to be set up)

  3. 'npm init' (if you want to answer some questions). 'npm init -y' (if you want to bypass questions)

  4. Now you will see package.json in your repo. let's download express by 'npm i express'

  5. Now set up nodemon so I can watch server running using 'npm i -D nodemon'. create "start": "nodemon index.js"

  6. set up express server in your index.js

  const express = require('express');
  const app = express();
  const port = 3000;

  app.listen(port, () => console.log (`Successfully started server at port ${port}`);
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
ehdtlaos
Edrick Ee

Posted on August 13, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related