npm i -g @adonisjs/cli
You are viewing the legacy version of AdonisJS. Visit https://adonisjs.com for newer docs. This version will receive security patches until the end of 2021.
This guide gets you started with AdonisJs by installing the framework and required dependencies. By the end of this guide, you will have a working AdonisJs web server with the Hello world page.
If you face any troubles installing AdonisJs, please file an issue on github.
Once requirements to run AdonisJs Apps are met, the next step is to install the cli tool, which will help us in creating new AdonisJs applications.
The cli tool is installed globally using npm.
npm i -g @adonisjs/cli
Once the installation completes, make sure that you can run adonis
from your command line.
adonis --help
Continue, if everything works as expected. Otherwise please create an issue on github
Let’s start by creating a new application using the cli tool new
command. It accepts the project name/folder as a required parameter.
adonis new yardstick
_ _ _ _
/ \ __| | ___ _ __ (_)___ | |___
/ _ \ / _` |/ _ \| '_ \| / __|_ | / __|
/ ___ \ (_| | (_) | | | | \__ \ |_| \__ \
/_/ \_\__,_|\___/|_| |_|_|___/\___/|___/
✔ Your current Node.js & npm version match the AdonisJs requirements!
✔ Cloned [adonisjs/adonis-fullstack-app]
✔ npm: Dependencies installed
✔ Default environment variables copied
✔ generated unique APP_KEY
┌───────────────────────────────────┐
│ Application crafted │
│ │
│ cd yardstick │
│ adonis serve --dev │
└───────────────────────────────────┘
Once the installation process is completed, you can cd
into the directory and run the following command to start the HTTP server.
adonis serve --dev
Started server in dev mode
[date] - info: serving app on 127.0.0.1:3333
The serve
command starts the HTTP server on port defined inside the .env
file in the project root. If you open 127.0.0.1:3333 inside your browser, you will see the following welcome page.
The adonis new <PATH>
command creates the project directory and does npm install
for you automatically. You can pass --yarn
to make use of yarn over npm.
By default fullstack app blueprint is cloned from Github, which can be customized by passing --slim
or --api-only
flag.
To make use of community created blueprints, you can pass --blueprint=<github-org/repo>
.
When in doubt, make use of the adonis new --help command to see the list of available options.
|
This guide was small and focused only on the installation part of the process. Going forward we will learn about the HTTP lifecycle and the folder structure.