Skip to content

JustroX/tent-dome

Repository files navigation

Tent

REST API Framework

Tent-Dome automatically creates REST API endpoints from model definitions.

Installation

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

Quickstart - Tent application in 26 lines.

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:

  1. Create a new document
POST :3000/api/books { name : "Harry Potter" }
  1. Read a document
GET :3000/api/books/{id}
  1. Update a document
PUT :3000/api/books/{id} { name : "Harry Potter - Edited" }
  1. List all documents
GET :3000/api/books
  1. Delete a document
DELETE :3000/api/books/{id}

Documentation

See this link for the documentation.

Usage

  1. Models
  • Expand
  1. REST URLs
  • CRUD operations
  • LIST operations
  • Pagination
  • Filters
  • Sorting
  • Advanced queries
  1. Routes
  • Builders
  • Accessors
  • Dispatchers
  • Prebuilt Middlewares
  1. Plugins

Core Roadmap

  • Sanitation
  • Validation needs refactor
  • Expand Query
  • Virtual fields
  • Methods and Statics
  • Authentication Plugin needs refactor
  • Permissions Plugin needs refactor
  • Rate Limiting
  • Decorator Functions

Fun features

  • Cloudinary Schema Type
  • Redis Plugin
  • Websocket Plugin

Testing

npm test

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request ❤

License

GNU General Public License

About

Typescript implementation of `justrox-tent`. REST API server framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published