We'll start building the API by creating a new Adonis app. We'll use the Adonis CLI installed earlier to create a new Adonis app. We'll call the app tweetr-api:

adonis new tweetr-api --api-only

By passing the --api-only flag, we are telling the Adonis CLI to use the API only blueprint while creating the app. This will create an app well suited for building APIs as things like views won’t be included.

Once it's done. We can test the app to make sure everything is working as expected:

Table of Contents

    cd tweetr-api
    adonis serve --dev

    The application should be up and runnning on http://127.0.0.1:3333. You should get a JSON response as below when you visit the URL:

        {
          "greeting": "Hello world in JSON"
        }

    Chimezie Enyinnaya

    20 posts

    Software Developer [PHP Laravel JavaScript NodeJS AdonisJS VueJS] | movie lover | run http://openlaravel.com