V1.2.0
Find leads based on open job vacanciesGet started96 Companies using AdonisJS
Want to download the entire list?
Enter your email and download the entire list of 96+ companies
Alternatives to AdonisJS
Thera are a total of 89 alternatives available for AdonisJS
How to use AdonisJS
AdonisJS is a Node.js web framework that provides a robust set of features for building scalable and maintainable applications. Here are some ways you can use AdonisJS:
- Creating a new project: You can create a new AdonisJS project using the CLI (Command Line Interface) tool, which will generate a basic application structure with all the necessary files and folders.
adonis new myapp
- Routing: AdonisJS provides an expressive routing system that allows you to define routes for your application with ease. You can specify HTTP methods, URL patterns, and controller actions to handle requests.
Route.get('/', 'HomeController.index')
- Controllers: AdonisJS follows the MVC (Model-View-Controller) pattern and provides a rich set of tools for creating controllers. Controllers are responsible for handling requests and returning responses.
class HomeController { async index ({ view }) { return view.render('welcome') } }
- Views: AdonisJS uses Edge as its templating engine, which provides a powerful syntax for creating HTML templates. Views can be rendered from controllers with data passed as context.
<!DOCTYPE html> <html> <head> <title>AdonisJS</title> </head> <body> <h1>Hello {{ name }}</h1> </body> </html>
- Database: AdonisJS comes with built-in support for several databases including SQLite, MySQL, PostgreSQL, and MSSQL. You can use AdonisJS ORM, Lucid to interact with your database which makes it easy to work with models, relationships, and query builders.
class User extends Model { static get table () { return 'users' } static get primaryKey () { return 'id' } posts () { return this.hasMany('App/Models/Post') } }
- Authentication: AdonisJS provides a simple and secure authentication system that can be used to protect routes, authenticate users, and manage sessions.
class AuthController { async login ({ auth, request }) { const { email, password } = request.all() await auth.attempt(email, password) return 'Logged in successfully' } async logout ({ auth }) { await auth.logout() return 'Logged out successfully' } }
- Middleware: AdonisJS allows you to define middleware functions that can be executed before or after controller actions. Middleware can be used for authentication, input validation, logging, and more.
class CheckAge { async handle ({ request, response }, next) { const age = request.input('age') if (age < 18) { return response.status(403).send('You are not old enough to enter') } await next() } } Route.get('/club', 'ClubController.enter').middleware('checkAge')
These are just a few examples of how you can use AdonisJS to build web applications. With its powerful features and easy-to-use tools, AdonisJS is a great choice for developers who want to build scalable and maintainable Node.js applications.
Make your sales data-driven.
Website's technology stack, including its CMS, ecommerce platform, and payment processor, along with details about the industry, company and its contacts.
GDPR Compliant
CCPA Compliant
SOC2 Compliant
