4. ā¦ 7 years in IT
ā¦ 3 years in SoftServe
dovcharitweekend2013
Aboutme
5. ā¦ 7 years in IT
ā¦ 3 years in SoftServe
ā¦ 7 months Application Architect
dovcharitweekend2013
Aboutme
6. ā¦ 7 years in IT
ā¦ 3 years in SoftServe
ā¦ 7 months Application Architect
ā¦ Main language: Javascript
dovcharitweekend2013
Aboutme
7. ā¦ 7 years in IT
ā¦ 3 years in SoftServe
ā¦ 7 months Application Architect
ā¦ Main language: Javascript
ā¦ Hobby language: Go
dovcharitweekend2013
Aboutme
8. ā¦ 7 years in IT
ā¦ 3 years in SoftServe
ā¦ 7 months Application Architect
ā¦ Main language: Javascript
ā¦ Hobby language: Go
ā¦ Pacemaker conference
dovcharitweekend2013
Aboutme
9. ā¦ 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
dovcharitweekend2013
Aboutme
10. ā¦ 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)
dovcharitweekend2013
Aboutme
13. NodeWay in my project NodeWay in my dreams
dovcharitweekend2013
Agenda
14. NodeWay in my project NodeWay in my dreams
ā¦Nodejs
ā¦Installation
ā¦My Project
ā¦Architecture
ā¦Project statistics
ā¦Code health goal
ā¦Before
ā¦After
ā¦Development process
ā¦Conclusion
dovcharitweekend2013
Agenda
15. NodeWay in my project NodeWay in my dreams
ā¦Nodejs
ā¦Installation
ā¦My Project
ā¦Architecture
ā¦Project statistics
ā¦Code health goal
ā¦Before
ā¦After
ā¦Development process
ā¦Conclusion
dovcharitweekend2013
ā¦What is Sails
ā¦Features
ā¦Get Started
ā¦MVC Structure
ā¦Routers
ā¦Assets
ā¦Policies
ā¦Deployment
ā¦Sockets
ā¦Conclusion
Agenda
16. NodeJSdovcharitweekend2013
Ā«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
17. NodeJSdovcharitweekend2013
Ā«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
18. NodeJSdovcharitweekend2013
Ā«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
20. Installationdovcharitweekend2013
Install on Linux
Ubuntu, Mint
Example install:
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
It 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-common
As of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev.
There is a naming conļ¬ict 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 conļ¬ict.
44. ProjectStatisticsdovcharitweekend2013
ā¦ 2 years development
ā¦ 10 scrum teams
ā¦ 59 modules
ā¦ 3200 javascript ļ¬les
ā¦ 200.000 lines of code
ā¦ 1.826 total violations
ā¦ 28.3% average coverage
45. ProjectStatisticsdovcharitweekend2013
ā¦ 2 years development
ā¦ 10 scrum teams
ā¦ 59 modules
ā¦ 3200 javascript ļ¬les
ā¦ 200.000 lines of code
ā¦ 1.826 total violations
ā¦ 28.3% average coverage
ā¦ >5000 unit tests
59. Beforedovcharitweekend2013
ā¦ A lot of manual work
ā¦ More than 5 different sources for analysis and counting
ā¦ JSTD: js test driver for running tests on CI
60. Beforedovcharitweekend2013
ā¦ 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 :)
61. Beforedovcharitweekend2013
ā¦ 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
62. Beforedovcharitweekend2013
ā¦ 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
63. Beforedovcharitweekend2013
ā¦ 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
68. Afterdovcharitweekend2013
ā¦ 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)
69. Afterdovcharitweekend2013
ā¦ 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 ļ¬les, etc.
70. Afterdovcharitweekend2013
ā¦ 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 ļ¬les, etc.
ā¦ Weāve put counting code health on Sonarās shoulders for
back-end as well as UI
71. Afterdovcharitweekend2013
ā¦ 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 ļ¬les, 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
72. Afterdovcharitweekend2013
ā¦ 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 ļ¬les, 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
92. Sailsdovcharitweekend2013
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?
95. Featuresdovcharitweekend2013
ā¦ 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.
96. Featuresdovcharitweekend2013
ā¦ 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.
97. Featuresdovcharitweekend2013
ā¦ 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.
98. Featuresdovcharitweekend2013
ā¦ 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.
99. Featuresdovcharitweekend2013
ā¦ 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.
142. Routersdovcharitweekend2013
ā¦ If the URL is not speciļ¬ed in conļ¬g/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.
143. Routersdovcharitweekend2013
ā¦ If the URL is not speciļ¬ed in conļ¬g/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.