This is the fullstack boilerplate for AdonisJs, it comes pre-configured with.
- Bodyparser
- Session
- Authentication
- Web security middleware
- CORS
- Edge template engine
- Lucid ORM
- Migrations and seeds
Use the adonis command to install the blueprint
adonis new yardstick
or manually clone the repo and then run npm install
.
Run the following command to run startup migrations.
adonis migration:run
- npm install laravel-mix --save-dev
- cp node_modules/laravel-mix/setup/webpack.mix.js ./
add scripts to package.json
"scripts": { "dev": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }
The only dependencies of the framework are Node.js and npm. Required versions:
Node.js >= 8.0.0 npm >= 3.0.0
run this
npm install update the .env file with correct environmental values
Set up a MySQL server
AdonisJs CLI is a command line tool to help you install AdonisJs.
Install it globally via npm like so:
npm i -g @adonisjs/cli
To create a new application, simply run:
adonis new appNameHere
After completion, issue the following commands:
cd appNameHere
Install mysql:
adonis install mysql
Visit the /.env file and change DB_CONNECTION to mysql: along with setting the database to appNameHere:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_USER=root DB_PASSWORD= DB_DATABASE=appNameHere
Call the adonis make:migration command to create a schema file:
adonis make:migration tableName
When prompted, choose the Create table option and press Enter:
Choose an action Create table √ create database\migrations\1536680712439_tableName_schema.js
Run migration command to push tables to the DB
adonis migration:run
Run command to run app
adonis serve --dev
Use the Adonis CLI to create a new model for newTableName data:
adonis make:model newTableName
To create a new controller, use the make:controller command:
for HTTP Controller
adonis make:controller ControllerNameHere --type http