+ All Categories
Home > Technology > NodeWay in my project & sails.js

NodeWay in my project & sails.js

Date post: 06-May-2015
Category:
Upload: dmytro-ovcharenko
View: 4,666 times
Download: 0 times
Share this document with a friend
Popular Tags:
154
NodeWay dovchar 2013
Transcript
Page 1: NodeWay in my project & sails.js

NodeWay

dovchar 2013

Page 2: NodeWay in my project & sails.js

dovchar itweekend 2013

Abo

ut m

e

Page 3: NodeWay in my project & sails.js

✦ 7 years in IT

dovchar itweekend 2013

Abo

ut m

e

Page 4: NodeWay in my project & sails.js

✦ 7 years in IT

✦ 3 years in SoftServe

dovchar itweekend 2013

Abo

ut m

e

Page 5: NodeWay in my project & sails.js

✦ 7 years in IT

✦ 3 years in SoftServe

✦ 7 months Application Architect

dovchar itweekend 2013

Abo

ut m

e

Page 6: NodeWay in my project & sails.js

✦ 7 years in IT

✦ 3 years in SoftServe

✦ 7 months Application Architect

✦ Main language: Javascript

dovchar itweekend 2013

Abo

ut m

e

Page 7: NodeWay in my project & sails.js

✦ 7 years in IT

✦ 3 years in SoftServe

✦ 7 months Application Architect

✦ Main language: Javascript

✦ Hobby language: Go

dovchar itweekend 2013

Abo

ut m

e

Page 8: NodeWay in my project & sails.js

✦ 7 years in IT

✦ 3 years in SoftServe

✦ 7 months Application Architect

✦ Main language: Javascript

✦ Hobby language: Go

✦ Pacemaker conference

dovchar itweekend 2013

Abo

ut m

e

Page 9: NodeWay in my project & sails.js

✦ 7 years in IT

✦ 3 years in SoftServe

✦ 7 months Application Architect

✦ Main language: Javascript

✦ Hobby language: Go

✦ Pacemaker conference

✦ Script’n’Code meet-up

dovchar itweekend 2013

Abo

ut m

e

Page 10: NodeWay in my project & sails.js

✦ 7 years in IT

✦ 3 years in SoftServe

✦ 7 months Application Architect

✦ Main language: Javascript

✦ Hobby language: Go

✦ Pacemaker conference

✦ Script’n’Code meet-up

✦ Open source (typescript grails, clio go, sonar qunit)

dovchar itweekend 2013

Abo

ut m

e

Page 11: NodeWay in my project & sails.js

dovchar itweekend 2013

Age

nda

Page 12: NodeWay in my project & sails.js

NodeWay in my project

dovchar itweekend 2013

Age

nda

Page 13: NodeWay in my project & sails.js

NodeWay in my project NodeWay in my dreams

dovchar itweekend 2013

Age

nda

Page 14: NodeWay in my project & sails.js

NodeWay in my project NodeWay in my dreams

✦Nodejs✦Installation ✦My Project✦Architecture✦Project statistics ✦Code health goal✦Before✦After✦Development process ✦Conclusion

dovchar itweekend 2013

Age

nda

Page 15: NodeWay in my project & sails.js

NodeWay in my project NodeWay in my dreams

✦Nodejs✦Installation ✦My Project✦Architecture✦Project statistics ✦Code health goal✦Before✦After✦Development process ✦Conclusion

dovchar itweekend 2013

✦What is Sails✦Features ✦Get Started✦MVC Structure✦Routers ✦Assets✦Policies✦Deployment✦Sockets ✦Conclusion

Age

nda

Page 16: NodeWay in my project & sails.js

Nod

eJS

dovchar itweekend 2013

«Node.js is a software platform that is used to build scalable network (especially server-side) applications. Node.js utilizes JavaScript as its scripting language, and achieves high throughput via non-blocking I/O and a single-threaded event loop.

Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software, such as Apache or Lighttpd, and allowing more control of how the web server works.»

Wikipedia

Page 17: NodeWay in my project & sails.js

Nod

eJS

dovchar itweekend 2013

«Node.js is a software platform that is used to build scalable network (especially server-side) applications. Node.js utilizes JavaScript as its scripting language, and achieves high throughput via non-blocking I/O and a single-threaded event loop.

Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software, such as Apache or Lighttpd, and allowing more control of how the web server works.»

Wikipedia

‣Original author(s): Ryan Lienhart Dahl‣Stable release: 0.10.18 / September 4, 2013‣Preview release: 0.11.7 / August 21, 2013‣Development status: Active‣Written in C++, JavaScript‣Operating system: Mac OS X, Linux, Solaris, FreeBSD, OpenBSD, Windows (older versions require Cygwin), webOS‣Type: Event-driven networking‣License: MIT‣Website: nodejs.org

Page 18: NodeWay in my project & sails.js

Nod

eJS

dovchar itweekend 2013

«Node.js is a software platform that is used to build scalable network (especially server-side) applications. Node.js utilizes JavaScript as its scripting language, and achieves high throughput via non-blocking I/O and a single-threaded event loop.

Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software, such as Apache or Lighttpd, and allowing more control of how the web server works.»

Wikipedia

‣Original author(s): Ryan Lienhart Dahl‣Stable release: 0.10.18 / September 4, 2013‣Preview release: 0.11.7 / August 21, 2013‣Development status: Active‣Written in C++, JavaScript‣Operating system: Mac OS X, Linux, Solaris, FreeBSD, OpenBSD, Windows (older versions require Cygwin), webOS‣Type: Event-driven networking‣License: MIT‣Website: nodejs.org

Page 19: NodeWay in my project & sails.js

Inst

alla

tion

dovchar itweekend 2013

Install on OSXUsing a package:Simply download Macintosh Installer

Using homebrew:brew install nodeUsing macports:port install nodejs

Page 20: NodeWay in my project & sails.js

Inst

alla

tion

dovchar itweekend 2013

Install on LinuxUbuntu, MintExample install:sudo apt-get install python-software-properties python g++ makesudo add-apt-repository ppa:chris-lea/node.jssudo apt-get updatesudo apt-get install nodejsIt installs current stable Node on the current stable Ubuntu. Quantal (12.10) users may need to install the software-properties-commonpackage for the add-apt-repository command to work: sudo apt-get install software-properties-commonAs of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev.There is a naming conflict with the node package (Amateur Packet Radio Node Program), and the nodejs binary has been renamed fromnode to nodejs. You'll need to

symlink /usr/bin/node to /usr/bin/nodejs or you could uninstall the Amateur Packet Radio Node Program to avoid that conflict.

Page 21: NodeWay in my project & sails.js

Inst

alla

tion

dovchar itweekend 2013

Install on WindowsUsing a package:Simply download Windows Installer.

Using chocolatey to install Node:cinst nodejs or for full install with NPM:cinst nodejs.install

Page 22: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 23: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 24: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 25: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 26: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 27: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 28: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 29: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 30: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 31: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 32: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 33: NodeWay in my project & sails.js

Abo

ut P

roje

ct

dovchar itweekend 2013

Page 34: NodeWay in my project & sails.js

Arc

hite

ctur

e

dovchar itweekend 2013

Page 35: NodeWay in my project & sails.js

Arc

hite

ctur

e

dovchar itweekend 2013

Page 36: NodeWay in my project & sails.js

Arc

hite

ctur

e

dovchar itweekend 2013

Page 37: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

Page 38: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

✦ 2 years development

Page 39: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

✦ 2 years development

✦ 10 scrum teams

Page 40: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

✦ 2 years development

✦ 10 scrum teams

✦ 59 modules

Page 41: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

✦ 2 years development

✦ 10 scrum teams

✦ 59 modules

✦ 3200 javascript files

Page 42: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

✦ 2 years development

✦ 10 scrum teams

✦ 59 modules

✦ 3200 javascript files

✦ 200.000 lines of code

Page 43: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

✦ 2 years development

✦ 10 scrum teams

✦ 59 modules

✦ 3200 javascript files

✦ 200.000 lines of code

✦ 1.826 total violations

Page 44: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

✦ 2 years development

✦ 10 scrum teams

✦ 59 modules

✦ 3200 javascript files

✦ 200.000 lines of code

✦ 1.826 total violations

✦ 28.3% average coverage

Page 45: NodeWay in my project & sails.js

Proj

ect S

tatis

tics

dovchar itweekend 2013

✦ 2 years development

✦ 10 scrum teams

✦ 59 modules

✦ 3200 javascript files

✦ 200.000 lines of code

✦ 1.826 total violations

✦ 28.3% average coverage

✦ >5000 unit tests

Page 46: NodeWay in my project & sails.js

What is Node.js doing here?!

dovchar itweekend 2013

Page 47: NodeWay in my project & sails.js

Code health goal 90%

dovchar itweekend 2013

Page 48: NodeWay in my project & sails.js

Cod

e H

ealth

dovchar itweekend 2013

Source

Page 49: NodeWay in my project & sails.js

Cod

e H

ealth

dovchar itweekend 2013

Source

Architecture &Design

Page 50: NodeWay in my project & sails.js

Cod

e H

ealth

dovchar itweekend 2013

Source

Architecture &Design

Duplications

Page 51: NodeWay in my project & sails.js

Cod

e H

ealth

dovchar itweekend 2013

Source

Architecture &Design

Duplications

Unit tests

Page 52: NodeWay in my project & sails.js

Cod

e H

ealth

dovchar itweekend 2013

Source

Architecture &Design

Duplications

Unit tests

Complexity

Page 53: NodeWay in my project & sails.js

Cod

e H

ealth

dovchar itweekend 2013

Source

Architecture &Design

Duplications

Unit tests

Potential bugs Complexity

Page 54: NodeWay in my project & sails.js

Cod

e H

ealth

dovchar itweekend 2013

Source

Architecture &Design

Duplications

Coding rules Unit tests

Potential bugs Complexity

Page 55: NodeWay in my project & sails.js

Cod

e H

ealth

dovchar itweekend 2013

Source

Comments

Architecture &Design

Duplications

Coding rules Unit tests

Potential bugs Complexity

Page 56: NodeWay in my project & sails.js

Befo

re

dovchar itweekend 2013

Page 57: NodeWay in my project & sails.js

Befo

re

dovchar itweekend 2013

✦ A lot of manual work

Page 58: NodeWay in my project & sails.js

Befo

re

dovchar itweekend 2013

✦ A lot of manual work

✦ More than 5 different sources for analysis and counting

Page 59: NodeWay in my project & sails.js

Befo

re

dovchar itweekend 2013

✦ A lot of manual work

✦ More than 5 different sources for analysis and counting

✦ JSTD: js test driver for running tests on CI

Page 60: NodeWay in my project & sails.js

Befo

re

dovchar itweekend 2013

✦ A lot of manual work

✦ More than 5 different sources for analysis and counting

✦ JSTD: js test driver for running tests on CI

✦ Strange custom ruby scripts (still have no idea what they were used for :)

Page 61: NodeWay in my project & sails.js

Befo

re

dovchar itweekend 2013

✦ A lot of manual work

✦ More than 5 different sources for analysis and counting

✦ JSTD: js test driver for running tests on CI

✦ Strange custom ruby scripts (still have no idea what they were used for :)

✦ Sonar showed only back-end code

Page 62: NodeWay in my project & sails.js

Befo

re

dovchar itweekend 2013

✦ A lot of manual work

✦ More than 5 different sources for analysis and counting

✦ JSTD: js test driver for running tests on CI

✦ Strange custom ruby scripts (still have no idea what they were used for :)

✦ Sonar showed only back-end code

✦ Code coverage was to get in a separate application which made the automatic analysis even more complicated

Page 63: NodeWay in my project & sails.js

Befo

re

dovchar itweekend 2013

✦ A lot of manual work

✦ More than 5 different sources for analysis and counting

✦ JSTD: js test driver for running tests on CI

✦ Strange custom ruby scripts (still have no idea what they were used for :)

✦ Sonar showed only back-end code

✦ Code coverage was to get in a separate application which made the automatic analysis even more complicated

✦ Code health was counted in exel with its magic formulas that mysteriously worked hiding the real problems

Page 64: NodeWay in my project & sails.js

Total CRAP...

dovchar itweekend 2013

Page 65: NodeWay in my project & sails.js

Afte

r

dovchar itweekend 2013

Page 66: NodeWay in my project & sails.js

Afte

r

dovchar itweekend 2013

✦ We’ve refused from everything we had before but the existing tests

Page 67: NodeWay in my project & sails.js

Afte

r

dovchar itweekend 2013

✦ We’ve refused from everything we had before but the existing tests

✦ We’ve decided to switch to node.js for non-functional requirements

Page 68: NodeWay in my project & sails.js

Afte

r

dovchar itweekend 2013

✦ We’ve refused from everything we had before but the existing tests

✦ We’ve decided to switch to node.js for non-functional requirements

✦ We’ve chosen grunt.js for running node.js tasks (running unit tests, counting code coverage, creating reports for Sonar, checking the code semantics and complexity: jshint)

Page 69: NodeWay in my project & sails.js

Afte

r

dovchar itweekend 2013

✦ We’ve refused from everything we had before but the existing tests

✦ We’ve decided to switch to node.js for non-functional requirements

✦ We’ve chosen grunt.js for running node.js tasks (running unit tests, counting code coverage, creating reports for Sonar, checking the code semantics and complexity: jshint)

✦ We’ve excluded any manual intervention: sided applications for code coverage, exel creepy files, etc.

Page 70: NodeWay in my project & sails.js

Afte

r

dovchar itweekend 2013

✦ We’ve refused from everything we had before but the existing tests

✦ We’ve decided to switch to node.js for non-functional requirements

✦ We’ve chosen grunt.js for running node.js tasks (running unit tests, counting code coverage, creating reports for Sonar, checking the code semantics and complexity: jshint)

✦ We’ve excluded any manual intervention: sided applications for code coverage, exel creepy files, etc.

✦ We’ve put counting code health on Sonar’s shoulders for back-end as well as UI

Page 71: NodeWay in my project & sails.js

Afte

r

dovchar itweekend 2013

✦ We’ve refused from everything we had before but the existing tests

✦ We’ve decided to switch to node.js for non-functional requirements

✦ We’ve chosen grunt.js for running node.js tasks (running unit tests, counting code coverage, creating reports for Sonar, checking the code semantics and complexity: jshint)

✦ We’ve excluded any manual intervention: sided applications for code coverage, exel creepy files, etc.

✦ We’ve put counting code health on Sonar’s shoulders for back-end as well as UI

✦ We’ve fastened unit testing on CI

Page 72: NodeWay in my project & sails.js

Afte

r

dovchar itweekend 2013

✦ We’ve refused from everything we had before but the existing tests

✦ We’ve decided to switch to node.js for non-functional requirements

✦ We’ve chosen grunt.js for running node.js tasks (running unit tests, counting code coverage, creating reports for Sonar, checking the code semantics and complexity: jshint)

✦ We’ve excluded any manual intervention: sided applications for code coverage, exel creepy files, etc.

✦ We’ve put counting code health on Sonar’s shoulders for back-end as well as UI

✦ We’ve fastened unit testing on CI

✦ We’ve prevented the developers from failed builds and have given them the clear system for code quality analysis and correction

Page 73: NodeWay in my project & sails.js

Exam

ple

dovchar itweekend 2013

Page 74: NodeWay in my project & sails.js

Dev

elop

men

t pro

cess

dovchar itweekend 2013

Page 75: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

Page 76: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

Page 77: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

+

Page 78: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

+

Page 79: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

+ +

Page 80: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

+ +

Page 81: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

=

+ +

Page 82: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

=

+ +

Page 83: NodeWay in my project & sails.js

Nod

ejs f

ram

ewor

ks

dovchar itweekend 2013

Page 84: NodeWay in my project & sails.js

Nod

ejs f

ram

ewor

ks

dovchar itweekend 2013

Page 85: NodeWay in my project & sails.js

Nod

ejs f

ram

ewor

ks

dovchar itweekend 2013

Page 86: NodeWay in my project & sails.js

Nod

ejs f

ram

ewor

ks

dovchar itweekend 2013

Page 87: NodeWay in my project & sails.js

Nod

ejs f

ram

ewor

ks

dovchar itweekend 2013

Page 88: NodeWay in my project & sails.js

Nod

ejs f

ram

ewor

ks

dovchar itweekend 2013

Page 89: NodeWay in my project & sails.js

Nod

ejs f

ram

ewor

ks

dovchar itweekend 2013

Page 90: NodeWay in my project & sails.js

Nod

ejs f

ram

ewor

ks

dovchar itweekend 2013

Page 91: NodeWay in my project & sails.js

Sails

dovchar itweekend 2013

What is Sails.js?

Page 92: NodeWay in my project & sails.js

Sails

dovchar itweekend 2013

Sails.js make it easy to build custom, enterprise-grade Node.js apps. It is designed to mimic the MVC pattern of frameworks like Ruby on Rails, but with support for the requirements of modern apps: data-driven APIs with scalable, service-oriented architecture. It's especially good for building chat, realtime dashboards, or multiplayer games.

What is Sails.js?

Page 93: NodeWay in my project & sails.js

Feat

ures

dovchar itweekend 2013

Page 94: NodeWay in my project & sails.js

Feat

ures

dovchar itweekend 2013

✦ Sails.js is database agnostic. Its ORM, Waterline, provides a simple data access layer that works, no matter what database you're using.

Page 95: NodeWay in my project & sails.js

Feat

ures

dovchar itweekend 2013

✦ Sails.js is database agnostic. Its ORM, Waterline, provides a simple data access layer that works, no matter what database you're using.

✦ Sails.js automatically generates a RESTful JSON API for your app. That means you don't have to write any backend code to build simple database apps.

Page 96: NodeWay in my project & sails.js

Feat

ures

dovchar itweekend 2013

✦ Sails.js is database agnostic. Its ORM, Waterline, provides a simple data access layer that works, no matter what database you're using.

✦ Sails.js automatically generates a RESTful JSON API for your app. That means you don't have to write any backend code to build simple database apps.

✦ Realtime Socket.io requests are routed to your controllers the same way as everything else: with resourceful conventions and URL mappings.

Page 97: NodeWay in my project & sails.js

Feat

ures

dovchar itweekend 2013

✦ Sails.js is database agnostic. Its ORM, Waterline, provides a simple data access layer that works, no matter what database you're using.

✦ Sails.js automatically generates a RESTful JSON API for your app. That means you don't have to write any backend code to build simple database apps.

✦ Realtime Socket.io requests are routed to your controllers the same way as everything else: with resourceful conventions and URL mappings.

✦ Sails.js provides basic security and role-based access control by default, and you can add as many custom policies as you like.

Page 98: NodeWay in my project & sails.js

Feat

ures

dovchar itweekend 2013

✦ Sails.js is database agnostic. Its ORM, Waterline, provides a simple data access layer that works, no matter what database you're using.

✦ Sails.js automatically generates a RESTful JSON API for your app. That means you don't have to write any backend code to build simple database apps.

✦ Realtime Socket.io requests are routed to your controllers the same way as everything else: with resourceful conventions and URL mappings.

✦ Sails.js provides basic security and role-based access control by default, and you can add as many custom policies as you like.

✦ Because Express and Socket.io share the same configurable session store, all of your security policies are reused for realtime WebSocket requests as well.

Page 99: NodeWay in my project & sails.js

Feat

ures

dovchar itweekend 2013

✦ Sails.js is database agnostic. Its ORM, Waterline, provides a simple data access layer that works, no matter what database you're using.

✦ Sails.js automatically generates a RESTful JSON API for your app. That means you don't have to write any backend code to build simple database apps.

✦ Realtime Socket.io requests are routed to your controllers the same way as everything else: with resourceful conventions and URL mappings.

✦ Sails.js provides basic security and role-based access control by default, and you can add as many custom policies as you like.

✦ Because Express and Socket.io share the same configurable session store, all of your security policies are reused for realtime WebSocket requests as well.

✦ Sails.js has automatic asset minification. With Sails, you just put your files in the proper folder and they are automatically included in your layout. Then, when you're ready to go into production, they are minified and gzipped to preserve as much bandwidth as possible.

Page 100: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

Page 101: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 102: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 103: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 104: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 105: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 106: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 107: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 108: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 109: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 110: NodeWay in my project & sails.js

Get

Sta

rted

dovchar itweekend 2013

npm install -g sails

Page 111: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

Page 112: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

Page 113: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

Page 114: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

Page 115: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

Page 116: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()

Page 117: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()✦ req.isSocket

Page 118: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()✦ req.isSocket✦ req.isAjax

Page 119: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()✦ req.isSocket✦ req.isAjax✦ req.isJson

Page 120: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()✦ req.isSocket✦ req.isAjax✦ req.isJson✦ res.view()

Page 121: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()✦ req.isSocket✦ req.isAjax✦ req.isJson✦ res.view()✦ res.send()

Page 122: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()✦ req.isSocket✦ req.isAjax✦ req.isJson✦ res.view()✦ res.send()✦ res.json()

Page 123: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()✦ req.isSocket✦ req.isAjax✦ req.isJson✦ res.view()✦ res.send()✦ res.json()✦ res.redirect()

Page 124: NodeWay in my project & sails.js

Con

trolle

r

dovchar itweekend 2013

✦ req.param()✦ req.isSocket✦ req.isAjax✦ req.isJson✦ res.view()✦ res.send()✦ res.json()✦ res.redirect()✦ res.viewExists

Page 125: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

Page 126: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

Page 127: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

Page 128: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

Page 129: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

Page 130: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

Page 131: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

Page 132: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

✦ Custom Defined Instance Methods

Page 133: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

✦ Custom Defined Instance Methods

✦ Lifecycle callbacks

Page 134: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

✦ Custom Defined Instance Methods

✦ Lifecycle callbacks

✦ Custom tables name

Page 135: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

✦ Custom Defined Instance Methods

✦ Lifecycle callbacks

✦ Custom tables name

✦ Adapters

Page 136: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

✦ Custom Defined Instance Methods

✦ Lifecycle callbacks

✦ Custom tables name

✦ Adapters

✦ Associations

Page 137: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

✦ Custom Defined Instance Methods

✦ Lifecycle callbacks

✦ Custom tables name

✦ Adapters

✦ Associations

✦ Automatic schema creation

Page 138: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

✦ Custom Defined Instance Methods

✦ Lifecycle callbacks

✦ Custom tables name

✦ Adapters

✦ Associations

✦ Automatic schema creation

✦ Data manipulation: create, findOne, find, dynamic finders (i.e findByName), update, destroy,

Page 139: NodeWay in my project & sails.js

Mod

el

dovchar itweekend 2013

✦ Attributes

✦ Validations

✦ Instance Methods (save, destroy, toObject, toJSON)

✦ Custom Defined Instance Methods

✦ Lifecycle callbacks

✦ Custom tables name

✦ Adapters

✦ Associations

✦ Automatic schema creation

✦ Data manipulation: create, findOne, find, dynamic finders (i.e findByName), update, destroy,

✦ Migrations

Page 140: NodeWay in my project & sails.js

dovchar itweekend 2013

View

/Ass

ets

Page 141: NodeWay in my project & sails.js

Rout

ers

dovchar itweekend 2013

Page 142: NodeWay in my project & sails.js

Rout

ers

dovchar itweekend 2013

✦ If the URL is not specified in config/routes.js, the default route for a URL is: /:controller/:action/:id where :controller, :action, and the :id request parameter are derived from the url.

✦ If the requested controller/action doesn't exist: - if a view exists ( /views/:controller/:action.ejs), Sails will render that view - if no view exists, but a model exists, Sails will automatically generate a JSON API for the model which matches :controller. - if no view OR model exists, Sails will respond with a 404.

Page 143: NodeWay in my project & sails.js

Rout

ers

dovchar itweekend 2013

✦ If the URL is not specified in config/routes.js, the default route for a URL is: /:controller/:action/:id where :controller, :action, and the :id request parameter are derived from the url.

✦ If the requested controller/action doesn't exist: - if a view exists ( /views/:controller/:action.ejs), Sails will render that view - if no view exists, but a model exists, Sails will automatically generate a JSON API for the model which matches :controller. - if no view OR model exists, Sails will respond with a 404.

Page 144: NodeWay in my project & sails.js

Und

er th

e hu

d

dovchar itweekend 2013

Page 145: NodeWay in my project & sails.js

Und

er th

e hu

d

dovchar itweekend 2013

✦ Policies

✦ Custom adapters

✦ Deployment

✦ Configurations

✦ Database support

✦ Sockets

Page 146: NodeWay in my project & sails.js

Con

clus

ion

dovchar itweekend 2013

Page 147: NodeWay in my project & sails.js

Link

s

dovchar itweekend 2013

Page 148: NodeWay in my project & sails.js

Link

s

dovchar itweekend 2013

✦ Node.js

Page 149: NodeWay in my project & sails.js

Link

s

dovchar itweekend 2013

✦ Node.js

✦ Sonarqube

Page 153: NodeWay in my project & sails.js

Que

stio

ns?

dovchar itweekend 2013

Page 154: NodeWay in my project & sails.js

Questions?

dovchar itweekend 2013


Recommended