node package manager
Stop wasting time. Easily manage code sharing in your team. Create a free org ยป

richmond-web-controller

Richmond Web Controller

Official Demo Web controller for richmond.js

CI Coverage Status Downloads Version License

This package is the official demo Web controller for the richmond.js package.

Installation

$ npm init
$ npm install richmond --save
$ npm install richmond-web-controller --save

Usage and Documentation

Because this is the official demo controller for the richmond.js core library, it is heavily documented in that package.

You can find the documentation here:

Summary of Features

  • Richmond Web Controller
  • All requests take the form of: http [ s ] ://host [ :port ] / prefix / :model [ / :id ]
    • port is provided by richmond.js
    • prefix is provided by richmond.js
    • model is the name of the MongoDB collection
    • id is the optional MongoDB id passed in if a request requires it
  • Connects to MongoDB
  • Supports all HTTP methods:
    • DELETE
    • GET - single record (getOne) and collections (getMany)
    • POST
    • PUT
    • PATCH
  • Supports requests and responses in JSON format (Content-Type: application/json).
  • Supports Multiple Models
  • Supports SSL:
    • 404 - if a Non-SSL request is made, will return 404 (not found).
    • 302 - if a Non-SSL request is made, will return 302 (moved) and redirect to the SSL equivalent.
  • Supports richmond.js token management.
  • Supports rights management through tokens.
  • Supports wrappers for intercepting requests before and after they are made.

Tests

Run the tests in one of the following two ways:

$ mocha --timeout 20000

Or

$ npm test

The tests generate log files in a logs/ folder under the projects root folder.


Repos


Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.


Version History

Version 0.1.9 release notes

  • brought code coverage up to 82%

Version 0.1.8 release notes

  • updated test cases, integrated ngrok, travis-ci, codecov

Version 0.1.7 release notes

  • Updated test cases to use logs/ folder

Version 0.1.6 release notes

  • Added new github repo to package.json
  • Updated README with repo list

Version 0.1.5 release notes

  • Refined README

Version 0.1.4 release notes

  • Updated README to keep in sync with richmond.js core.

Version 0.1.3 release notes

  • Removed validation of param id (:id)
  • mongoose.Types.ObjectId.isValid(req.params.id) is rejecting valid ids
  • Bogus test also failed because it said an id of 'thisisabadid' was valid.

Version 0.1.2 release notes

  • Refactored internal logging.

Version 0.1.1 release notes

  • Updated repo url

Version 0.1.0 release notes

  • Initial release