sails

2019-10-12

sails是什么

什么是sails,API-driven framework for building realtime apps, using MVC conventions (based on Express and Socket.io)

sails使用教程帮助文档

sails.js logo">Sails.js logo

websiteget starteddocsnewssubmit issue">WebsiteGet StartedDocsNewsSubmit Issue

NPM versionGitterTwitter Follow

Sails.js is a web frameworkthat makes it easy to build custom, enterprise-grade Node.js apps. It is designed to resemble the MVC architecture from frameworks like Ruby on Rails, but with support for the more modern, data-oriented style of web app & API development. It's especially good for building realtime features like chat.

Since version 1.0, Sails supports awaitout of the box. This replaces nested callbacks (and the commensurate error handling) with simple, familiar usage:

var orgs = await Organization.find();

Installation

With nodeinstalled:

# Get the latest stable release of Sails
$ npm install sails -g
Upgrading from an earlier version of Sails?

Available as of Node >=v7.9 and Sails >=v1.0, ES8's async/await enables dramatic improvements to the way developers build Node.js / Sails apps. It allows server-side JavaScript code to be written with the awaitkeyword, instead of lower-level (and more fragile) flow control mechanisms like nested callbacks and promise chains. It lets developers breathe easier by removing the burden of painstaking, manual error handling after every database query. And best of all, it means the end of "callback hell": the most common source of bugs and stability issues in real world Node.js / Sails applications.

If ES8 isn't for you, don't worry-- Node callbacks and promise chaining are still fully supported. But for most teams, the transition to awaitresults in sizable gains in productivity, with fewer lines of code.

Upgrade guides for all major releases since 2013 are available on the Sails website under Upgrading.

Your First Sails Project

Create a new app:

# Create the app
sails new my-app

Lift sails:

# cd into the new folder
cd my-app

# fire up the server
sails lift

Screenshot from the original Sails video

For the most up-to-date introduction to Sails, get started here.

Compatibility

Sails is built on Node.js, Express, and Socket.io.

Sails actionsare compatible with Connect middleware, so in most cases, you can paste code into Sails from an existing Express project and everything will work-- plus you'll be able to use WebSockets to talk to your API, and vice versa.

The ORM, Waterline, has a well-defined adapter system for supporting all kinds of datastores. Officially supported databases include MySQL, PostgreSQL, MongoDB, Redis, and local disk / memory. Community adapters exist for CouchDB, neDB, TingoDB, SQLite, Oracle, MSSQL, DB2, ElasticSearch, Riak, neo4j, OrientDB, Amazon RDS, DynamoDB, Azure Tables, RethinkDBand Solr; for various 3rd-party REST APIs like Quickbooks, Yelp, and Twitter, including a configurable generic REST API adapter; plus some eclectic projects.

Powered by MySQL

For the latest core adapters and notable community adapters, see Available Adapters.

Tutorial Course

Books

Support

Need help or have a question?

Issue Submission

Please read the submission guidelinesand code of conductbefore opening a new issue. Click hereto search/post issues in this repository.

Contribute

There are many different ways you can contribute to Sails:

Please carefully read our contribution guideand check the build statusfor the relevant branch before submitting a pull request with code changes.

Links

Team

Sails is actively maintained with the help of many amazing contributors. Our core team consists of:

Mike McNeilRachael ShawRaquel EstevezJohn AbramsMadison Hicks
Mike McNeilRachael ShawRaquel EstevezJohn AbramsMadison Hicks
Cody StoltmanScott GressIrl Nathan
Cody StoltmanScott GressIrl Nathan

Our companydesigns/builds Node.js websites and apps for startups and enterprise customers. After building a few applications and taking them into production, we realized that the Node.js development landscape was very much still the Wild West. Over time, after trying lots of different methodologies, we decided to crystallize all of our best practices into this framework. Six years later, Sails is now one of the most widely-used web application frameworks in the world. I hope it saves you some time! :)

License

MIT LicenseCopyright © 2012-present, Mike McNeil

Sails is built around so many great open-source technologies that it would never have crossed our minds to keep it proprietary. We owe huge gratitude and props to Ryan Dahl (@ry), TJ Holowaychuk (@tj), Doug Wilson (@dougwilson) and Guillermo Rauch (@rauchg) for the work they've done, as well as the stewards of all the other open-source modules we use. Sails could never have been developed without your tremendous contributions to the JavaScript community.

image_squidhome@2x.png


上一篇:用 map 代替纯 JavaScript 对象
下一篇:modjs
相关教程
关注微信

扫码加入 JavaScript 社区

相关文章

首次访问,需要验证
微信扫码,关注即可
(仅需验证一次)

欢迎加入 JavaScript 社区

号内回复关键字:

回到顶部