1.1 KiB
1.1 KiB
AdonisJS v5 Boilerplate
Using repository and service pattern
Setup
- Clone this repository
git clone git@gitlab.com:profile-image/boilerplate/adonisjs-v5-boilerplate.git - Copy file
.env.exampleto.env - Create database
- Run
boilerplate.sqlin folderdatabase/sql - Change database name and connection in
.env - Run command
npm installto install dependencies - Run server with
npm run dev
Creating Module
Create model, repository, service, controller, validators and route using below command:
node ace make:module <Namespace> <ModelName> --endpoint <EndpointName> --soft-delete --uuid
Example: I will make module for user table with soft delete
node ace make:module User User --endpoint users --soft-delete
Notes:
- Namespace is required and using CamelCase.
- ModelName is required and using CamelCase.
- EndpointName is required and using lowercase. If endpoint have more than one word, separate them with
-. - --soft-delete is optional. Use only when your table has
deleted_atcolumn. - --uuid is optional. Use only when your primaryKey using uuid.