https://github.com/survi218/node-modules
Node and the HTTP Module
https://github.com/survi218/node-modules
callback-functions error-handler get node-http node-module nodejs npm post postman requirejs server-core
Last synced: about 2 months ago
JSON representation
Node and the HTTP Module
- Host: GitHub
- URL: https://github.com/survi218/node-modules
- Owner: survi218
- Created: 2017-05-29T03:43:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-03T12:37:29.000Z (almost 8 years ago)
- Last Synced: 2025-03-05T21:57:38.624Z (about 2 months ago)
- Topics: callback-functions, error-handler, get, node-http, node-module, nodejs, npm, post, postman, requirejs, server-core
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-modules
#Node modules:
- HTTP, fs and path. At the end of this exercise, you will be able to:
- Implement a simple HTTP Server
- Implement a server that returns html files from a folder
* A Simple HTTP Server
- Create a folder named node-http at a convenient location and move into the folder.
- In the node-http folder, create a subfolder named public.
- Create a file named server-1.js and add the following code to it:````
var http = require('http');var hostname = 'localhost';
var port = 3000;var server = http.createServer(function(req, res){
console.log(req.headers);
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end('Hello World
');
})
server.listen(port, hostname, function(){
console.log(`Server running at http://${hostname}:${port}/`);
});
````