Skip to content

Starting point for building a scalable Restify API.

Notifications You must be signed in to change notification settings

j--w/Restify-Seed

Repository files navigation

Restify-Seed

Starting point for building a scalable Restify API.

##Example## See ./routes/foo.js:

api.post('/baz/:id', ... 

...and follow the code along to the controller and model to get a feel for how the codebase is structured.

##Includes:## MVC Design Pattern

Helps separate concerns, ensuring a maintainable codebase.

Content Negotiation

JSON (or XML) response is available via:

Accept: application/json

Spec Testing Library

Using the included Jasmine library, simply include your API's tests in ./testing.

Common Utilities

  • Crypto - PBKDF2 password hasher
  • dsjslib - datastructures library
  • Lodash - functional utilities library
  • Moment - advanced date/time library

Intelligent Error Handling

By leveraging domains, error handling is gracefully handled and (optionally) reported via the emailjs module (see config.js config.environment to set up email).

Caching

The Redis module is included for caching. Be sure to alter config.js redis.servers information to match your server(s).

Rate Limiting

As seen in the code example (top of README.md), rate limiting is defined at the route-level for extra control. This module depends on Redis for storage.

i18n

Internationalization can be achieved by specifying the API's locales in config.js and creating a js file of the same name in ./locales. The module binds itself with the HTTP request such that this header:

Accept-Language: de

...will determine the HTTP response's language (provided the module's res.__('output_key') format is used when responding).

##Notes

Database Layer

With an emphasis on keeping this project unopinionated, no O/RM or database utilities have been provided. This module will be determined by your use-case, just be sure to use the config.js for connection details and keep things DRY.

Load Balancer

If a load balancer is desired, consider node-harmony

Production Process Managemernt

If a process manager is desired, consider pm2

##Installation Ensure Redis is installed on your platform, clone this repo (will have an NPM link up soon), cd to dir with package.json:

$ npm install

License

MIT

About

Starting point for building a scalable Restify API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published