Fastest way to create Rest API by defining database models and their relations.
Please read the following issue: The future of AdonisX
This project is under development and not ready for production.
AdonisX is the fastest way to create Rest API by defining only database models and their relationships between them. It is built on AdonisJs, and it's an awesome ORM library, Lucid. AdonisX takes AdonisJs' power and speeds it up! It analyzes models and their relationships and creates all Rest API routes automatically.
You are going to be able to develop an API 10 times faster!
AdonisX uses the basic structure of AdonisJs. It is a Service Provider which works in the initialization process of an AdonisJs application. It performs two basic functions;
Let's assume that you have a model like this;
const XModel = use('AdonisX/Models/XModel')
class User extends XModel {
}
With this model, you will have all of the endpoints for users resource. AdonisX will create CRUD routes for you in the initialization and routes will be completely ready to be handled and processed by the shared controller.
If you execute adonis route:list command in your terminal, you can see all routes which have been created by AdonisX.
All these requests will be handled by MainController. MainController is a controller which is controlled by AdonisX. It handles requests for all models. It is responsible to prepare a response for the user by model definitions. In model definitions, you can decide many things such as form validation, custom middlewares and , etc.
When you visit /api/users
URL in your browser, you can see AdonisX is responding your request;
With AdonisX, you don't have to code for all CRUD actions. You don't have to implement advanced query features. The only thing to do is defining models and their relations between each other. That's all! <Emoji code="1f389"></Emoji>
To clone and run this application, you'll need Git, Node.js and nodemon installed on your computer. From your command line:
$ npm install -g @adonisjs/cli adonisx-cli
$ adonisx new
$ cd adonisx-example
$ yarn
$ adonis migration:run
$ yarn serve
nodemon server.js
[nodemon] 2.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
info: serving app on http://127.0.0.1:3333
That's all! Your API is ready to develop!
Do you need more? Check the awesome documentation.
Please take a look at our contributing guidelines if you're interested in helping!