8000 GitHub - mbonano/moya: A platform built on node.js for developing lean, componentized and highly scalable RESTful, Hypermedia APIs
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ moya Public

A platform built on node.js for developing lean, componentized and highly scalable RESTful, Hypermedia APIs

Notifications You must be signed in to change notification settings

mbonano/moya

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moya

A platform built on node.js for developing lean, componential and highly scalable RESTful Hypermedia APIs

Overview

Moya is comprised of a variety of technologies that, together, address many major development concerns:

  • nconf - Configuration Management
  • restify - A RESTful API development module

Examples

Moya was developed to manage the core dependencies required to develop RESTful Hypermedia APIs. Because of this, moya makes if very easy to immediately begin developing your endpoints. Here's an example:

var moya = require('moya');
var nconf = moya.nconf;

var server = moya.createServer({
    name: 'moya-application'
});

server.get('/', function(req, res, next) {
    var entryPointResponse = {
        version : "0.0.0",

        _links : {
            self: { href: "/" },
            orders: { href: "/orders" }
        },

        name : "my api entry point"
    };
    res.send(entryPointResponse);
    return next();
});

server.listen(nconf.get('http:port'), '0.0.0.0', function() {
    console.log('%s listening on %s', server.name, server.url);
});

You would run the code above (assuming it was saved in a file called index.js) as follows:

node index.js

Note that the server is initiated to listen on a port that is being read externally:

server.listen(nconf.get('http:port'), ...

Moya is preconfigured to support external config files. Make a new file called app.conf.json with the following contents:

{
    "http": {
        "port": 8090
    }
}

You can now pass your configuration files as command line arguments when starting your node application. This is customarily an essential step when configuring continuous integration:

node index.js --conf=app.conf.json

You application will now run on port 8090, as specified in the app.conf.json file supplied at the command line

Client SDK's

Various client sdk's are currently in development.

About

A platform built on node.js for developing lean, componentized and highly scalable RESTful, Hypermedia APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0