Web Interface to a Node.js REST service

Web Interface to a Node.js REST service using Jade, Stylus, jQuery and AJAX.

Introduction

This tutorial is a continuation of the previous tutorial REST Service with Node.js, MongoDB and Express. In this section, we will be adding a web interface to the REST service that we created. Since explanations were already covered for some of the parts in the previous tutorial, we won’t re-visit the explanations here. We will only cover the code that is being changed for this tutorial.

The code for this tutorial is available here on github.

Getting Started

The first step is to setup a new route. If you remember, the previous example you could use the address http://localhost:3000/users to access the REST service, but the root path returned nothing. This time we will add a web page to the root which will be used to manage the “users” REST service.

The following line will be added to the app.js file: