DEV Community

Bipon Biswas
Bipon Biswas

Posted on • Updated on

Create your first NODE server

prerequisite software
node, express, npm, yarn, or any code editor
Step 1: create a folder like node-api in desktop or any location in your computer
Step 2: open VS Editor > Terminal (keyboard command : Ctrl + ~)
then run yarn init. Create a package.json file

{
"name": "app",
"version": "1.0.0",
"license": "MIT",
}

Step 3: create a index.js file into app folder

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

app.get('/', (req, res) => {
    res.send('I am from Node JS!!')
})
app.listen(4000, () =>{
    console.log('server created and listening port 4000')
})
Enter fullscreen mode Exit fullscreen mode

Discussion (0)