restr
v0.0.4
Published
A tiny library for writing RESTfull applications
Downloads
2
Maintainers
Readme
restr is a small application which makes it super-easy to define your own restfull services. API endpoints are defined in a language-neutral JSON format, and the implementation is as simple as exporting a set of functions.
:warning: restr is still in development. New features will be added in upcoming releases.
Install globally with:
npm i -g restr
Roadmap
The following features will be added in an upcoming release:
- Watching for changes
- Auto-validation before dispatching to controller
See the first milestone for details.
QuickStart
Let's create a mock service which tells the consumer that his user was successfully created:
api.json
{
"name": "my-service",
"version": "1",
"endpoints": {
"POST /users": "createNewUser",
"GET /user/:name": "fetchUserInfo"
}
}
controllers.js
export function createNewUser(params) {
return { created: true }
}
Next, let's run our service.
$ restr
restr will automatically notify when a certain controller was not found.
See the examples/ directory for a full setup.