REST API Framework
Tent-Dome automatically creates REST API endpoints from model definitions.
tent-dome
is currently at v0.0.1
things won't get published on npm
until v1.0.0
.
For the meantime you can install directly from the repository.
npm install https://github.com/JustroX/tent-dome.git
import { Tent } from "tent-dome";
//1. Initialize Tent
Tent.init({
"mongoose uri": "URI TO DATABASE"
});
//2. Define entity.
var BooksEntity = tent.Entity("Book",{
name : String,
date : { type: Date, default: Date.now }
});
//3. Assign CRUD(+L) routes on entity
BooksEntity.Routes.create();
BooksEntity.Routes.update();
BooksEntity.Routes.read();
BooksEntity.Routes.list();
BooksEntity.Routes.delete();
//Register entity
BooksEntity.register()
//Start app at port 3000.
Tent.register();
Tent.start(3000);
And that's it! You can now access your REST API server on port 3000 via the following HTTP requests:
- Create a new document
POST :3000/api/books { name : "Harry Potter" }
- Read a document
GET :3000/api/books/{id}
- Update a document
PUT :3000/api/books/{id} { name : "Harry Potter - Edited" }
- List all documents
GET :3000/api/books
- Delete a document
DELETE :3000/api/books/{id}
See this link for the documentation.
- Expand
- REST URLs
- CRUD operations
- LIST operations
- Pagination
- Filters
- Sorting
- Advanced queries
- Routes
- Builders
- Accessors
- Dispatchers
- Prebuilt Middlewares
- Sanitation
- Validation
needs refactor
- Expand Query
- Virtual fields
- Methods and Statics
- Authentication Plugin
needs refactor
- Permissions Plugin
needs refactor
- Rate Limiting
- Decorator Functions
- Cloudinary Schema Type
- Redis Plugin
- Websocket Plugin
npm test
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request ❤