Skip to content

Instantly share code, notes, and snippets.

View jayesh96's full-sized avatar
🎯
Focusing

Jayesh Bidani jayesh96

🎯
Focusing
View GitHub Profile
@jayesh96
jayesh96 / gist:3f39cc098255f2f288a5da6ecbcf1ca9
Last active September 4, 2021 09:49
Running a server on port 3000
// Step1: create a package
npm init
// Step2: create index.js file in same folder as package.json and copy this code
const http = require('http');
// Create an instance of the http server to handle HTTP requests
let app = http.createServer((req, res) => {
// Set a response type of plain text for the response
res.writeHead(200, {'Content-Type': 'text/plain'});