├── .gitignore
├── README.md
├── index.js
├── package-lock.json
└── package.json
/.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 |
--------------------------------------------------------------------------------
/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 | Home
12 |
13 |
14 | Home page
15 |
16 | `);
17 | });
18 |
19 | server.listen(port, hostname, () => {
20 | console.log(`Server running at http://${hostname}:${port}/ happily`);
21 | });
22 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "basichttpserevr",
3 | "version": "1.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "basichttpserevr",
9 | "version": "1.0.0",
10 | "license": "MIT",
11 | "dependencies": {
12 | "nodemon": "^3.1.0"
13 | }
14 | },
15 | "node_modules/abbrev": {
16 | "version": "1.1.1",
17 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
18 | "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
19 | },
20 | "node_modules/anymatch": {
21 | "version": "3.1.3",
22 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
23 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
24 | "dependencies": {
25 | "normalize-path": "^3.0.0",
26 | "picomatch": "^2.0.4"
27 | },
28 | "engines": {
29 | "node": ">= 8"
30 | }
31 | },
32 | "node_modules/balanced-match": {
33 | "version": "1.0.2",
34 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
35 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
36 | },
37 | "node_modules/binary-extensions": {
38 | "version": "2.2.0",
39 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
40 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
41 | "engines": {
42 | "node": ">=8"
43 | }
44 | },
45 | "node_modules/brace-expansion": {
46 | "version": "1.1.11",
47 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
48 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
49 | "dependencies": {
50 | "balanced-match": "^1.0.0",
51 | "concat-map": "0.0.1"
52 | }
53 | },
54 | "node_modules/braces": {
55 | "version": "3.0.2",
56 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
57 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
58 | "dependencies": {
59 | "fill-range": "^7.0.1"
60 | },
61 | "engines": {
62 | "node": ">=8"
63 | }
64 | },
65 | "node_modules/chokidar": {
66 | "version": "3.6.0",
67 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
68 | "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
69 | "dependencies": {
70 | "anymatch": "~3.1.2",
71 | "braces": "~3.0.2",
72 | "glob-parent": "~5.1.2",
73 | "is-binary-path": "~2.1.0",
74 | "is-glob": "~4.0.1",
75 | "normalize-path": "~3.0.0",
76 | "readdirp": "~3.6.0"
77 | },
78 | "engines": {
79 | "node": ">= 8.10.0"
80 | },
81 | "funding": {
82 | "url": "https://paulmillr.com/funding/"
83 | },
84 | "optionalDependencies": {
85 | "fsevents": "~2.3.2"
86 | }
87 | },
88 | "node_modules/concat-map": {
89 | "version": "0.0.1",
90 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
91 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
92 | },
93 | "node_modules/debug": {
94 | "version": "4.3.4",
95 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
96 | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
97 | "dependencies": {
98 | "ms": "2.1.2"
99 | },
100 | "engines": {
101 | "node": ">=6.0"
102 | },
103 | "peerDependenciesMeta": {
104 | "supports-color": {
105 | "optional": true
106 | }
107 | }
108 | },
109 | "node_modules/fill-range": {
110 | "version": "7.0.1",
111 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
112 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
113 | "dependencies": {
114 | "to-regex-range": "^5.0.1"
115 | },
116 | "engines": {
117 | "node": ">=8"
118 | }
119 | },
120 | "node_modules/fsevents": {
121 | "version": "2.3.3",
122 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
123 | "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
124 | "hasInstallScript": true,
125 | "optional": true,
126 | "os": [
127 | "darwin"
128 | ],
129 | "engines": {
130 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
131 | }
132 | },
133 | "node_modules/glob-parent": {
134 | "version": "5.1.2",
135 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
136 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
137 | "dependencies": {
138 | "is-glob": "^4.0.1"
139 | },
140 | "engines": {
141 | "node": ">= 6"
142 | }
143 | },
144 | "node_modules/has-flag": {
145 | "version": "3.0.0",
146 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
147 | "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
148 | "engines": {
149 | "node": ">=4"
150 | }
151 | },
152 | "node_modules/ignore-by-default": {
153 | "version": "1.0.1",
154 | "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
155 | "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA=="
156 | },
157 | "node_modules/is-binary-path": {
158 | "version": "2.1.0",
159 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
160 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
161 | "dependencies": {
162 | "binary-extensions": "^2.0.0"
163 | },
164 | "engines": {
165 | "node": ">=8"
166 | }
167 | },
168 | "node_modules/is-extglob": {
169 | "version": "2.1.1",
170 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
171 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
172 | "engines": {
173 | "node": ">=0.10.0"
174 | }
175 | },
176 | "node_modules/is-glob": {
177 | "version": "4.0.3",
178 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
179 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
180 | "dependencies": {
181 | "is-extglob": "^2.1.1"
182 | },
183 | "engines": {
184 | "node": ">=0.10.0"
185 | }
186 | },
187 | "node_modules/is-number": {
188 | "version": "7.0.0",
189 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
190 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
191 | "engines": {
192 | "node": ">=0.12.0"
193 | }
194 | },
195 | "node_modules/lru-cache": {
196 | "version": "6.0.0",
197 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
198 | "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
199 | "dependencies": {
200 | "yallist": "^4.0.0"
201 | },
202 | "engines": {
203 | "node": ">=10"
204 | }
205 | },
206 | "node_modules/minimatch": {
207 | "version": "3.1.2",
208 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
209 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
210 | "dependencies": {
211 | "brace-expansion": "^1.1.7"
212 | },
213 | "engines": {
214 | "node": "*"
215 | }
216 | },
217 | "node_modules/ms": {
218 | "version": "2.1.2",
219 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
220 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
221 | },
222 | "node_modules/nodemon": {
223 | "version": "3.1.0",
224 | "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz",
225 | "integrity": "sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==",
226 | "dependencies": {
227 | "chokidar": "^3.5.2",
228 | "debug": "^4",
229 | "ignore-by-default": "^1.0.1",
230 | "minimatch": "^3.1.2",
231 | "pstree.remy": "^1.1.8",
232 | "semver": "^7.5.3",
233 | "simple-update-notifier": "^2.0.0",
234 | "supports-color": "^5.5.0",
235 | "touch": "^3.1.0",
236 | "undefsafe": "^2.0.5"
237 | },
238 | "bin": {
239 | "nodemon": "bin/nodemon.js"
240 | },
241 | "engines": {
242 | "node": ">=10"
243 | },
244 | "funding": {
245 | "type": "opencollective",
246 | "url": "https://opencollective.com/nodemon"
247 | }
248 | },
249 | "node_modules/nopt": {
250 | "version": "1.0.10",
251 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
252 | "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
253 | "dependencies": {
254 | "abbrev": "1"
255 | },
256 | "bin": {
257 | "nopt": "bin/nopt.js"
258 | },
259 | "engines": {
260 | "node": "*"
261 | }
262 | },
263 | "node_modules/normalize-path": {
264 | "version": "3.0.0",
265 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
266 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
267 | "engines": {
268 | "node": ">=0.10.0"
269 | }
270 | },
271 | "node_modules/picomatch": {
272 | "version": "2.3.1",
273 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
274 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
275 | "engines": {
276 | "node": ">=8.6"
277 | },
278 | "funding": {
279 | "url": "https://github.com/sponsors/jonschlinkert"
280 | }
281 | },
282 | "node_modules/pstree.remy": {
283 | "version": "1.1.8",
284 | "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
285 | "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w=="
286 | },
287 | "node_modules/readdirp": {
288 | "version": "3.6.0",
289 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
290 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
291 | "dependencies": {
292 | "picomatch": "^2.2.1"
293 | },
294 | "engines": {
295 | "node": ">=8.10.0"
296 | }
297 | },
298 | "node_modules/semver": {
299 | "version": "7.6.0",
300 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
301 | "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==",
302 | "dependencies": {
303 | "lru-cache": "^6.0.0"
304 | },
305 | "bin": {
306 | "semver": "bin/semver.js"
307 | },
308 | "engines": {
309 | "node": ">=10"
310 | }
311 | },
312 | "node_modules/simple-update-notifier": {
313 | "version": "2.0.0",
314 | "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
315 | "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==",
316 | "dependencies": {
317 | "semver": "^7.5.3"
318 | },
319 | "engines": {
320 | "node": ">=10"
321 | }
322 | },
323 | "node_modules/supports-color": {
324 | "version": "5.5.0",
325 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
326 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
327 | "dependencies": {
328 | "has-flag": "^3.0.0"
329 | },
330 | "engines": {
331 | "node": ">=4"
332 | }
333 | },
334 | "node_modules/to-regex-range": {
335 | "version": "5.0.1",
336 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
337 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
338 | "dependencies": {
339 | "is-number": "^7.0.0"
340 | },
341 | "engines": {
342 | "node": ">=8.0"
343 | }
344 | },
345 | "node_modules/touch": {
346 | "version": "3.1.0",
347 | "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
348 | "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
349 | "dependencies": {
350 | "nopt": "~1.0.10"
351 | },
352 | "bin": {
353 | "nodetouch": "bin/nodetouch.js"
354 | }
355 | },
356 | "node_modules/undefsafe": {
357 | "version": "2.0.5",
358 | "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
359 | "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA=="
360 | },
361 | "node_modules/yallist": {
362 | "version": "4.0.0",
363 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
364 | "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
365 | }
366 | }
367 | }
368 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------