← 返回命令列表

Linux command

sails 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Create new app

sails new [project-name]

Start development server

sails lift

Generate API

sails generate api [user]

Generate model

sails generate model [user]

Generate controller

sails generate controller [user]

Open console

sails console

Show version

sails --version

说明

Sails.js is an MVC web framework for Node.js, inspired by Ruby on Rails. It provides conventions and scaffolding for rapidly building REST APIs and web applications with a familiar structure of models, views, and controllers. A standout feature is Blueprints, which auto-generate RESTful API endpoints for models with full CRUD operations. Combined with the Waterline ORM, which supports MySQL, PostgreSQL, MongoDB, and other databases through a unified interface, applications can be prototyped with minimal code. Built-in Socket.io integration enables real-time features, allowing Blueprint routes to work over both HTTP and WebSockets. Policies provide middleware-like access control for protecting routes and enforcing authentication.

参数

new _NAME_
Create new app.
lift
Start server.
generate _TYPE_ _NAME_
Generate component.
console
Interactive REPL.
debug
Start app in debug mode.
--version
Show installed Sails version.
--port _PORT_
Set server port.
--prod
Start in production mode.

FAQ

What is the sails command used for?

Sails.js is an MVC web framework for Node.js, inspired by Ruby on Rails. It provides conventions and scaffolding for rapidly building REST APIs and web applications with a familiar structure of models, views, and controllers. A standout feature is Blueprints, which auto-generate RESTful API endpoints for models with full CRUD operations. Combined with the Waterline ORM, which supports MySQL, PostgreSQL, MongoDB, and other databases through a unified interface, applications can be prototyped with minimal code. Built-in Socket.io integration enables real-time features, allowing Blueprint routes to work over both HTTP and WebSockets. Policies provide middleware-like access control for protecting routes and enforcing authentication.

How do I run a basic sails example?

Run `sails new [project-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does new _NAME_ do in sails?

Create new app.