Giter Club home page Giter Club logo

adonisjs-demo's Introduction

Prerequisites

  • Docker >= 18.06.0
  • NodeJs >= 8.0.0
  • npm >= 3.0.0
  • Python >= 3.5
  • pip3 >= 19.0.3
  • docker-compose >= 1.22.0
  • mysql >= 5.7.25

Setup

  • Install all dependencies by executing below command :

    npm install

  • We will be using localstack to mimic SQS and S3 storage in local environment. Below command will setup localstack and redis into the docker.

    docker-compose up -d

  • After this you have to install awscli in order to create S3 bucket and SQS queues. To install awscli run below command.

    pip3 install awscli

  • We will create an S3 bucket and SQS queue in localstack. The setup.sh file will create the bucket and SQS queue that will be used in this demo but before we have to give permission to this file. Run below command to give permission.

    chmod +x setup.sh

  • After that run the script by this command,

    ./setup.sh

  • Rename .env.example to .env and assign database name to DB_DATABASE env variable.

  • After that install adonis cli by below command,

    npm i -g @adonisjs/cli

  • Run migration using below command,

    adonis migration:run

  • Run below command to start the app,

    adonis serve --dev

  • This framework is very similar to laravel framework, we can create migration (https://adonisjs.com/docs/4.1/migrations), controller (https://adonisjs.com/docs/4.1/controllers) just like laravel.
  • Configuration for MySql database is in config/database.js.
  • I have created the migration of two tables : Users and Todos, In Users table we will store users and in todo tables we will store todo note of each user.
  • Relationships between to models can be defined also like laravel, see app/models. More on this is explained in here https://adonisjs.com/docs/4.1/relationships
  • There is a postmaster collection of endpoints to check S3, redis, SQS, Prometheus in AdonisJs. The descrition for each point is given in it. You have to import it to the postmaster.
  • Support for the redis in AdonisJs is explained here https://adonisjs.com/docs/4.1/redis, Configuration file for redis can be changed from config/redis.js.
  • Support for S3 Storage in AdonisJs is explained here https://adonisjs.com/docs/4.1/file-system, Configuration file for S3 is located at config/drive.js.
  • Configuration for SQS is located in config/aws.js.
  • Prometheus data is generated by middlewares which are located in app/Middleware.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.