Introduction to REST API and Realtime
Is a web framework to build a web server using MVC pattern.
100% javascript
Any database
Frontend Agnostic
Security policies
Auto generate APIs
Support webSockets
Agnostic asset pipeline
Solid foundation
What's REST API ?
The definition about the architecture used communication Server / Client, where the data are accessed through a defined Interface.
Methods:
Get,POST, PUT, DELETE
First Install Sails
$ sudo npm install sails -g
Create a project
$ sails generate new <name-project>
Run Sails
$ sails lift
Generate API
$ sails generate api <name-api>
Model
Controller
Route
Attributes:
'string', 'integer', 'float', 'date', 'datetime', 'boolean', 'array'
Req:
Access to request
Res:
Response to request
Generate a "Shadow Routes"
(BluePrint Route)
Is a WebSocket?
Is protocol between Client / Server to establish a interactive communication.
Sails wrap socket.io
Backend
Resourceful PubSub
Frontend
Sails Socket
io.socket.post
io.socket.get
io.socket.put
io.socket.on
io.socket.off
http://rockalabs.com
jdmorales092@gmail.com
Snacks By