Sugar on top of restify and noodles.





GitHub Stars



Last Commit

7yrs ago






Size (min+gzip)




Type Definitions







In order to install you have to use npm as there is too much building that needs to take place to make it a "gitable" repo. A video tutorial going through the steps of building a rest service with RestComplete can be found here.

 npm install restcomplete

If you insist on checking it out with github. Make sure that you systematize the build command for dtrace-provider in restify. It's going to change based on what system you are on, but it must be part of your build process. Something like this:

 cd node_modules/restcomplete/node_modules/restify/node_modules/dtrace-provider
 node-waf configure
 node-waf build


RestComplete is really just a bunch of sugar. The bulk of the work is done by Restify and Noodles. What RestComplete does is provide a simple set of protocols that a user can create that will automatically both prop up the service and document the request and response schematics of the service. How this is accomplished is by passing a folder path that contains the services that need to be propped RestComplete either a command line argument or invoking it's "Init" method and passing that method the same folder path:

node node_modules/restcomplete/lib/restcomplete.js ./services

The preferred way is to construct a script that does this work (it makes it easier to utilize services like Forever this way):

var path = require('path');

If this is confusing so far, don't worry, it should be; RestComplete, as a whole, does a lot. The best way to learn how to use it is to look at the example folder. However some documentation is outlined here.


Here is an example of what a directory that utilizes RestComplete probably looks like.


"index.js" is the script that simply calls RestComplete and gives it the "services" folder (see above) as a string argument. What RestComplete then does is look at every file in the services folder and specifically looks for "config.js" and any file that ends with the postfix ".svc.js". These ".svc.js" files are the only files that RestComplete actually processes, though as we will see, they can require any necessary JavaScript files around them or require other node modules like any other node script file can do. Let's start with what the "config.js" file looks like. It controls a lot of the basic functionality of RestComplete:

exports.serverConfig = {
    port        :   8080,
    ipOrDomain  :   'myservice'
exports.serverOptions = {
    name        :   'My Web Services',
    version     :   '0.0.1',
    docsURIBase :   '/docs'
// If you are building out documentation
// use this to provide information
// to the documentor function.
exports.documentationConfig = {
    copyrightHolder     :   'My Company Inc.',
    copyrightWebSite    :   '',
    title               :   'My Company\'s Web Services'

exports.onServerListen = function(server){
    console.log('%s listening at %s',, server.url);

exports.restifyOptions = function(restify,server){

As you can see the "config.js" is pretty simple it simply outlines what port and ip/domain RestComplete will listen to in order to provide the services you will outline later. IT also has some ancillary information that will be used to build out the documentation of your services. You will also notice that the ability to "tweek" restify is exposed; it's probably best not to mess with these options unless you know what you are doing, but you can certainly look at restify's documentation to do so. Some of this configuration information is not required for RestComplete to work, but if you aren't interested in the documentation capability of RestComplete you might as well just use restify directly. Next we will look at what a service (".svc.js") file looks like:

// Node Modules
var helpService =   require('helperfile'),
    config      = require('./config');

var service = module.exports = {
    name: 'Service 1 API',
    root:'', //this could be a further path parameter 
    version: '0.0.1',
    intro: 'This is an intro for the service',
}; = {
    method:'GET',//necesarry for launch and docs
    name:'Service 1\'s GET sub service',//not necessary, the key will be used if this is not present.
    uri:'/subsvc1/:param1',//necessary for launch
    description:'A generic service for Service 1',
    notes:'This is where your explantory notes for this service will go. It can be as long as you want.',
        request:'http://' + config.serverConfig.ipOrDomain + '/subsvc1/foo?term=bar',

That's a lot to take in, I know, but it's actually pretty simple. Every single service passed to RestComplete is simply an object that has a name, a base documentation URI ("service1" in the example above), and a "services" object that contains "sub-service" object(s) that actually outline the functionality of the service (what method is used, the URI, what parameters will be derived from the URI, and the function that will handle all incoming requests for that service). As you would expect "method" can be any http method ("PUT","DELETE","POST",etc), which means that a service which defines it's http method as such will only respond to that http method even if the URI matches. The "uri" parameter of the sub-service object can, in turn, be a string (as seen above), but it can also be a Regular Expression (see restify for details). Finally the "proxy" field is the function that will accept every request for the particular sub-service. All other sub-service fields are used by the documentation engine and aren't actually part of the functionality of the service. So in theory the above object would work exactly the same way if it was presented like this:

// Node Modules
var helpService =   require('./helperfile'),
    config      = require('./config');

var service = module.exports = {
}; = {
    method:'GET',//necesarry for launch and docs
    uri:'/subsvc1/:param1',//necessary for launch

Finally we are going to look at the "helperfile" that seems to define this function that is "proxying" the request:

//Given a request of http://myservice/subsvc1/foo?term=bar
exports.service1 = {
    subServiceGet: function(server,request,response,next){
        var param1 = request.params["param1"],
            term = request.params["term"];
            "response":param1 +","+ term;
        return next();
//The response will look like:

Obviously this function can be used to handle more complicated logic or to call upon a nodeJS module or some other set of services. This example is simply here to illustrate how a response would work. For a complete understanding of how this response functionality works simply look at the (restify documentation)[], it will explain how to service a request with different types of responses (such as redirecting or 404 responses).

Rate & Review

Great Documentation0
Easy to Use0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Unwelcoming Community0