Posts

Showing posts from September, 2016

On the path to become a MEAN Developer - 2 (The N)

Part 1 is here:  On the path to become a MEAN Developer - 1 Lets start by creating our very own node server. Check if npm and node is properly installed on your machine Go to the location of your choice. Create a directory myapp. Goto myapp. Type npm init . It will give you certain options. Default options are good to go. A package.json file will be created. Create a server.js file. var http=require("http"), port=1234; var server=http.createServer(function(request, response){ response.writeHeader(200, {"Content-Type" : "text/plain"}); response.write("Hello world!"); response.end(); }); server.listen(port); console.log("server is listening on http://localhost:" + port); To run the server, >> node server.js server is listening on http://localhost:1234 Hit http://localhost:1234 from your web browser, you should get Hello World as the output.