AndyJarrett

Getting your Node JS + Express app deployed on Nodester

Nodester Allows you to Deploy your Node.JS applications to Nodester.com for FREE and is a good way to quickly get playing around with Node.js. The site has some quick guides for getting your app created and deployed within 40 seconds, this post is about getting from Hello World to having a Express+Jade site deployed. Before we continue some assumptions have been made: you know Git, you've installed Node, installed expressjs, signed up at nodester.com, and now just want to get your web goodness deployed to show the world.

The below commands are all run from a Mac terminal but should fire for any *nix.
  1. $ nodester app create [app name]
    • For this example my app will be called scribble and can be seen at scribble.nodester.com. When you run this call you will get a port number back i.e. 12332 Note this down!
  2. $ nodester app init scribble
    • At this point your app is running at http://[app name].nodester.com and you should see "Hello World". Basically you Node.js web app is running. Simples. Now we are going to add Express.js which is a node web framework.
  3. $ cd [app name]
  4. $ express
    • You'll get a message destination is not empty, continue?, type Yes and hit return at which point the folder structure will be setup.
  5. $ npm install dont forget to install dependencies
  6. When Express sets up it uses app.js and Nodester uses server.js easiest way to fix this is to run $ mv app.js server.js
  7. $ vi server.js open server.js and change the port number at the bottom (app.listen( xxxxx );) to the one you noted earlier i.e. 12332
  8. $ node server.js
    • We're running this to check everything is ok. Open your browser at localhost:[port number] and you should get the "Welcome to Express" message. Once you're happy go back to the terminal and ctrl-c
  9. $ git add .
  10. $ git commit -m"My first express.js commit"
  11. $ git push
  12. Thats it, the Push should of restarted your app, go to your Nodester URL and you should be up and running.