I was recently asked to look into building a sample application based on Node.js – more on that in another post. I only had a couple of days to figure this out and I am sure I didn’t do everything correctly but in the end it worked out great. I basically followed the instructions in this article, however, the best part of the article is the Express command to create the sample application code, ie. the famous “Hello World” example. This for me was a great launch pad in getting started. I was able to investigate the file structure and see how a Node.js + Express is constructed. So the first thing is to get up and running with Node.js, I installed it from the Install button on the Node.js site.
So what was the command?
express --sessions mynewapp
This resulted in the directory structure with all of the basic files configured to run.
The next command is to install the dependencies:
This installs all of the dependencies identified in package.json and a new directory should be generated:
The last step is to simply run the application server locally:
D:nodesportsapp>node app Express server listening on port 3000
You can then launch your application with the following URL: http://localhost:3000/