quail-rest
v1.1.27
Published
Hassle free mongodb rest app
Downloads
9
Readme
Quail
Hassle free mongodb rest app
Features
- Uses ACL (Access Control List) to better manage routes. So no route management.
- Uses built in JWT Token Authentication.
- Support for prevention of brute force attacks using express-brute
- Uses sails like models and controllers
- Blueprints to make life easy
- Support for embeded documents to enable transactions
#Installation
npm install -g quail-cli
#Prerequisite A running instance of mongodb
#Getting Started
- Create a project by running the command
quail create <myapp>
- Change directory to your app and npm install
cd myapp && npm install
- Create a model
quail add-model user
OR
quail m user
- Create a controller
quail add-controller user
OR
quail c user
- Run the app
npm start
Quail supports sails like blueprints out of the box but is protected by ACL(access control list). Change your acl to allow the following actions [find , findOne, create, update and destroy] for the user controller
module.exports = {
routes: {
authenticated: {},
not_authenticated: {
User:{
find: true,
findOne: true,
create: true,
update: true,
destroy: true,
}
}
}
}
Now restart the server and send a post request to http://localhost:3000/user with request body
*POST to http://localhost:3000/user
{
name : 'Quail',
}
Get all the user by sending a get request to http://localhost:3000/user
*GET to http://localhost:3000/user
Get a particular user by sending a get request to http://localhost:3000/user/:id
*GET to http://localhost:3000/user/:id
Update a particular user by sending a put request to http://localhost:3000/user/:id
*PUT to http://localhost:3000/user/:id
{
name:'Quail is awesome'
}
Destroy a particular user by sending a delete request to http://localhost:3000/user/:id
*DELETE to http://localhost:3000/user/:id
- Docs coming soon