introduction


本站和网页 https://docs.adonisjs.com/guides/introduction 的作者无关,不对其内容负责。快照谨为网络故障时之索引,不代表被搜索网站的即时页面。

Introduction AdonisJS Search ⌘ K
Migration Guide
V5 Documentation
Toggle color theme
AdonisJS on GitHub
Toggle Menu
Github
Theme
e.target.value === 'dark' ? $store.darkMode.enable() : $store.darkMode.disable()" id="theme_switcher">
Dark
Light
Getting started
Installation
Folder structure
Config
Environment variables
FAQs
Releases
HTTP
HTTP context
Routing
Controllers
Request
Response
Middleware
Cookies
Bodyparser middleware
File uploads
Validation
Session
URL builder
Exception handling
Views and Templates
Static file server
Assets bundling
Database
SQL & ORMs
Redis
Security
Hash
Encryption
Securing SSR apps
Rate limiter
CORS
Auth
Verifying user credentials
Session guard
Access tokens guard
Basic auth guard
Custom auth guards
Mail
Configuring message
Class-based mails
Fake mailer
Creating custom transports
Fundamentals
Application
Application lifecycle
AdonisRC file
IoC container
Container services
Service providers
Config providers
Async Local Storage
TypeScript build process
Hot module replacement (HMR)
Extending the framework
Scaffolding
Tooling config
Digging Deeper
Authorization
Emitter
Logger
Social authentication
Internationalization
Atomic Locks
Transmit
Testing
HTTP tests
Database tests
Browser tests
Command-line tests
Mocks and fakes
Ace command line
Creating commands
Command arguments
Command flags
Prompts
Terminal UI
REPL
Reference
Commands
Edge helpers and tags
Events
Exceptions
Helpers
Experimental
New Vite Integration
Assembler Hooks
Inertia
Toggle docs menu
Screencasts
AdonisJS VSCode extension
Edge VSCode extension
Japa VSCode extension
Community and Help
Discord server
X (Formerly Twitter)
GitHub discussions
Packages ecosystem
Priority Support
Insiders (Sponsorship) program
Sponsorships make this project sustainable by buying the maintainer's time, which is a scarce resource. This time is spent maintaining the framework, adding new features, and creating new first-party packages everyone asks for.
Click here to learn more about the Insiders program
and the benefits associated with it.
22% towards $8,000 per month goal
What is AdonisJS?
AdonisJS is a TypeScript-first web framework for Node.js. You can use it to create a full-stack web application or a JSON API server.
At the fundamental level, AdonisJS
provides structure to your applications
, configures a
seamless TypeScript development environment
, configures
HMR
for your backend code, and offers a vast collection of well-maintained and extensively documented packages.
We envision teams using AdonisJS
spending less time
on trivial decisions like cherry-picking npm packages for every minor feature, writing glue code, debating for the perfect folder structure, and
spending more time
delivering real-world features critical for the business needs.
Frontend agnostic
AdonisJS focuses on the backend and lets you choose the frontend stack of your choice.
If you like to keep things simple, pair AdonisJS with a
traditional template engine
to generate static HTML on the server. Or create a JSON API for your frontend Vue/React application.
AdonisJS aims to provide you with batteries to create a robust backend application from scratch. Be it sending emails, validating user input, performing CRUD operations, or authenticating users. We take care of it all.
Modern and Type-safe
AdonisJS is built on top of modern JavaScript primitives. We use ES modules, Node.js sub-path import aliases, SWC for executing TypeScript source, and Vite for assets bundling.
Also, TypeScript plays a considerable role when designing the framework's APIs. For example, AdonisJS has:
Type-safe event emitter
Type-safe environment variables
Type-safe validation library
Embracing MVC
AdonisJS embraces the classic MVC design pattern. You start by defining the routes using the functional JavaScript API, bind controllers to them and write logic to handle the HTTP requests within the controllers.
Copy code to clipboard
import
router
from
'
@adonisjs/core/services/router
PostsController
#controllers/posts_controller
get
posts
[PostsController
index
])
Controllers can use models to fetch data from the database and render a view (aka template) as a response.
HttpContext
@adonisjs/core/http
Post
#models/post
export
default
class
async
({
view
}:
const
await
all
()
return
render
pages/posts/list
If you are building an API server, you can replace the view layer with a JSON response. But, the flow of handling and responding to the HTTP requests remains the same.
/**
* Posts array will be serialized to JSON
* automatically.
*/
Guides assumptions
The AdonisJS documentation is written as a reference guide, covering the usage and the API of several packages and modules maintained by the core team.
The guide does not teach you how to build an application from scratch
. If you are looking for a tutorial, we recommend starting your journey with
Adocasts
. Tom (the creator of Adocasts) has created some highly quality screencasts, helping you to take the first steps with AdonisJS.
With that said, the documentation extensively covers the usage of available modules and the inner workings of the framework.
Recent releases
Following is the list of recent releases.
Click here
to view all the releases.
Package
Change
Released on
@adonisjs/core
Moving HMR out of experimental phase.
Apr 22, 2024
Experimental support for HMR.
Apr 15, 2024
Upgrade to VineJS 2.0.
@adonisjs/auth
Configure basic auth guard and export authFinder mixin from its own subpath.
Apr 2, 2024
@adonisjs/application
Add onHttpServerMessage hook.
Mar 31, 2024
Sponsors
List of individuals and companies publicly sponsoring
Harminder Virk on GitHub
If you are sponsoring and cannot see your name, ensure your
sponsorship is not private
Featured sponsors
Your logo
Gold sponsors
Silver sponsors
Backers
Past sponsors
© 2024 AdonisJS
Edit this page
On this page