Index.js
/*
*Primary file for the API
*
*/
// Dependencies
const http = require('http');
const server = http.createServer((req, res) =>{
if (req.url === '/'){
res.write('Hello World');
res.end();
}
});
//The server should respond to all requests with a string
server.listen(3000);
console.log('Listening on port 3000');
Then run on CMD Terminal
node index.js
/*
*Primary file for the API
*
*/
// Dependencies
const http = require('http');
const server = http.createServer((req, res) =>{
if (req.url === '/'){
res.write('Hello World');
res.end();
}
});
//The server should respond to all requests with a string
server.listen(3000);
console.log('Listening on port 3000');
Then run on CMD Terminal
node index.js
No comments:
Post a Comment