a Sails v1 application
- Sails framework documentation
- Version notes / upgrading
- Deployment tips
- Community support options
- Professional / enterprise options
This app was originally generated on Fri Oct 11 2019 00:36:56 GMT+0800 (Hong Kong Standard Time) using Sails v1.2.3.
A JavaScript runtime environment + Over 700k reusable packages/modules
-
Sails.js
- is designed to resemble the MVC architecture from frameworks like Ruby on Rails.
- is built on Node.js, uses Express for handling HTTP requests.
- bundles a powerful ORM, Waterline, which provides a simple data access layer that just works, no matter what database you use.
-
Sails MVC
Normal way:
sudo npm install -g sails
npm install
On windows with vscode, add:
set-ExecutionPolicy RemoteSigned
sails lift
- Bootstrap template engine
- see layout.ejs file under api/views/layouts.
- Loading initial testing data
- see bootstrap.js, located under the config folder.
- Routes Setting
- see routes.js
- Sample
'DELETE /Apartment/:id': 'ApartmentController.delete', 'GET /Apartment/Update/:id': 'ApartmentController.update', 'POST /Apartment/Update/:id': 'ApartmentController.update', 'GET /Apartment/Search/?': 'ApartmentController.search', 'GET /Apartment/Detail/:id': 'ApartmentController.detail', 'GET /Apartment/Home/': 'ApartmentController.home', 'GET /User/Login': 'UserController.login', 'POST /User/Login': 'UserController.login', 'POST /User/Logout': 'UserController.logout', 'GET /Apartment/:id/rentedBy': 'ApartmentController.populate', 'GET /user/:id/rents': 'UserController.populate', 'GET /user/:id/rents/add/:fk': 'UserController.add', 'GET /user/:id/rents/remove/:fk': 'UserController.remove', 'POST /file/upload/attachment': 'FileController.uploadAttachment'
- api
- under ./api
- Input Validation - Server-side
- Redirection
- AJAX
- Sample
async function submitForm(oFormElement) { var response = await fetch(oFormElement.action, { method: oFormElement.method, credentials: 'same-origin', body: new FormData(oFormElement) }); if (response.ok) { var data = await response.json(); alert(data.message); window.location = data.url; } else if (response.status == 401) { var data = await response.text(); // for res.send() alert(data); } else { alert(response.statusText); } };
- Sample
- Mobile App with NativeScript-Vue