Building a REST service
The first thing we have to do is create a little REST service. Representational State Transfer (REST) basically means that a service is stateless and makes use of the standard HTTP verbs like GET, PUT, POST, and DELETE. That makes it a bit easier for us to write. We can create a RESTful service using Node.js and Express, pretty much like we did before. So, create a new folder and name it web-api
or some such. Next, we need our package.json
file, so start up a command prompt and use the npm init
command. You can leave all the defaults, as we are not really going to do anything with them anyway. Next, we can install Express, the body-parser
, and the command-line-args
package:
npm install express --save npm install body-parser --save npm install command-line-args --save
We can now set up our bare bones script that allows us to at least run the application:
var express = require('express'), bodyParser = require('body-parser'), commandLineArgs = require('command-line...