How to build an simple server faster and Easier

make a light backend

Server started and say “Hiii Im the server”

In this post you will learn how to create Node Js Server in fours(4) step 😀 
  1. Initialize node in your folder

  2. Install express ( 😎)

  3. Create index.js file

  4. Launch server( 😱)

    So let’s go…🔥

1 / Initialize node in your folder

npm init -y

-y : it’s use to skip all params who node Js need .

Now you have these results 👇

node init finish

2 / Install express ( 😎)

Install express with

npm i express 

It’s ok

Now you have this file… his name is package. json

In the future lessons I will explain his functions

Change type :”commonjs” to type:”module”

package json

3 / Create index.js file

Like this

index js file

Add this code in this file

import express from "express"; const app = express(); app.listen(8100, () => { console.log("Hiii Im the server"); })

You have imported express + initialize with express ()

4/ Launch server( 😱)

Tape

node index.js

It's like 'hi node, the launch index is for me'.

Congrats you finish your first server with Node js

Welcome in Back-end dev life