DEV Community

Bipon Biswas
Bipon Biswas

Posted on • Edited on

1 1

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

Top comments (0)

Postgres on Neon - Get the Free Plan

No credit card required. The database you love, on a serverless platform designed to help you build faster.

Get Postgres on Neon