sails
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSails.js
Sails.js
Sails.js is the MVC backend framework in The Boring JavaScript Stack. It provides convention-over-configuration server-side architecture with actions, helpers, models, policies, hooks, and a powerful routing system. The Boring Stack defaults to the actions2 format for all controllers and helpers.
Sails is built on Express and uses the Waterline ORM for database access. It pairs with Inertia.js to render React, Vue, or Svelte frontends without building a separate API.
Sails.js是The Boring JavaScript Stack中的MVC后端框架。它提供了“约定优于配置”的服务器端架构,包含actions、helpers、模型、policies、hooks以及强大的路由系统。The Boring Stack默认对所有控制器和helpers采用actions2格式。
Sails基于Express构建,使用Waterline ORM进行数据库访问。它可与Inertia.js配合,无需构建单独的API即可渲染React、Vue或Svelte前端。
Rules
规则
Getting Started
入门指南
- getting-started - App anatomy, project structure, file conventions, .sailsrc, globals, bootstrap
- getting-started - 应用结构、项目架构、文件约定、.sailsrc、全局变量、引导程序
Core Concepts
核心概念
- actions - Actions2 format, inputs, exits, response types, and action patterns
- helpers - Reusable helpers with inputs, exits, sync/async, error handling
- routes - Route configuration, dynamic parameters, wildcards, route targets
- policies - Request guards, policy configuration, authentication patterns
- hooks - App-level hooks, lifecycle, shared data, custom hook patterns
- actions - Actions2格式、输入、输出、响应类型及action模式
- helpers - 可复用helpers,包含输入、输出、同步/异步、错误处理
- routes - 路由配置、动态参数、通配符、路由目标
- policies - 请求守卫、policy配置、认证模式
- hooks - 应用级hooks、生命周期、共享数据、自定义hook模式
Request Pipeline
请求管道
- request-lifecycle - How requests flow through hooks, middleware, policies, actions, and responses
- middleware - HTTP middleware pipeline, config/http.js, Express middleware, custom middleware
- request-lifecycle - 请求如何在hooks、中间件、policies、actions及响应之间流转
- middleware - HTTP中间件管道、config/http.js、Express中间件、自定义中间件
Configuration & Infrastructure
配置与基础设施
- configuration - Config files, environment variables, custom settings, datastores
- responses - Custom response types, the Inertia response flow, error responses
- security - CORS, CSRF, sessions, cookies, security best practices
- deployment - Production config, Redis sessions, environment setup, scaling
- configuration - 配置文件、环境变量、自定义设置、数据存储
- responses - 自定义响应类型、Inertia响应流程、错误响应
- security - CORS、CSRF、会话、Cookie、安全最佳实践
- deployment - 生产环境配置、Redis会话、环境搭建、扩容
Framework Reference
框架参考
- sails-object - The global sails object: sails.config, sails.helpers, sails.models, sails.log, sails.inertia
- file-uploads - File upload patterns with sails.uploadOne, Skipper, cloud storage
- shell-scripts - Background tasks, data migrations, maintenance scripts
- blueprints - Auto-generated REST API, blueprint configuration, when to use
- generators - Scaffolding with sails generate, custom generators, the page generator
- sails-object - 全局sails对象:sails.config、sails.helpers、sails.models、sails.log、sails.inertia
- file-uploads - 使用sails.uploadOne、Skipper、云存储的文件上传模式
- shell-scripts - 后台任务、数据迁移、维护脚本
- blueprints - 自动生成的REST API、blueprint配置、适用场景
- generators - 使用sails generate进行脚手架搭建、自定义生成器、页面生成器