http://rockalabs.com/ 

LET'S BUILD TOGETHER

LET'S BUILD TOGETHER

SailsJS

Introduction to REST API and Realtime

LET'S BUILD TOGETHER

what's Sails?

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

LET'S BUILD TOGETHER

Stack used by Sails?

Agnostic asset pipeline 

Solid foundation

LET'S BUILD TOGETHER

Auto generate APIs

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

LET'S BUILD TOGETHER

Auto generate APIs

First Install Sails

$ sudo npm install sails -g

Create a project

$ sails generate new <name-project>

Run Sails

$ sails lift

LET'S BUILD TOGETHER

Auto generate APIs

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)

LET'S BUILD TOGETHER

Support WebSockets

Is a WebSocket?

Is protocol between Client / Server to establish a interactive communication. 

Sails wrap socket.io

LET'S BUILD TOGETHER

Support WebSockets

Backend

Resourceful PubSub

Frontend

Sails Socket

io.socket.post

io.socket.get

io.socket.put

io.socket.on

io.socket.off

 

LET'S BUILD TOGETHER

http://rockalabs.com

jdmorales092@gmail.com

John Darwin Morales

Frontend Developer

ROCKALABS

Snacks By

By RockaLa​bs

Introducción a SailsJS

By John Darwin Morales González

Introducción a SailsJS

  • 1,633