├── .gitignore ├── README.md ├── package.json └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Steps 2 | 3 | ### Step1: npm install 4 | ### Step2: npm start 5 | ### Step3" Hit: http://localhost:3000 in chrome 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "basichttpserevr", 3 | "version": "1.0.0", 4 | "description": "Creating basic http server using in-build http module", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "nodemon index.js" 9 | }, 10 | "author": "VISHNU", 11 | "license": "MIT", 12 | "dependencies": { 13 | "nodemon": "^3.1.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const http = require("node:http"); 2 | 3 | const hostname = "127.0.0.1"; 4 | const port = 3000; 5 | 6 | const server = http.createServer((req, res) => { 7 | res.statusCode = 200; 8 | res.setHeader("Content-Type", "text/html"); 9 | res.end(` 10 |
11 |