Let Rest
Framework to really REST on your Rest.
Overview
Framework to implement a full secured Rest service just using declarative JSON configuration files
Dependencies
- Express 4.0
- Body parser
- moment
- jwt-simple
- uw
- jsonschema
- pg (Depends on the selected strategies)
- q
- winston
Install
npm install letrest
Config
The config file should be in the upper folder of the node_modules.
File | Description |
---|---|
config.js | this is related to UW configuration, not a specific let-rest configuration) |
letrest_entities.json | Configure all the services asociated to the entities |
letrest_security.json | Configure all the security services related parameters |
letrest_schema.json | Configure how has to validate all the JSON recived on the server |
Code
This code it is a basic boilerplate of a Express server. We have added comments so you can easily add the framework to your code
var express = ; //We requre the package var app = ; //We create the server var bodyParser = ; //Body parser, now separated since 4.0 app; //We set the parser as the first middleware var port = processenvPORT || 8080; //We define the port // ROUTES FOR OUR API // ============================================================================= var router = express; // get an instance of the express Router ; app; //We add a base to the URL for all request app; //We start the server loop