node.js web development using sails

15
MEAN Sailing: Node.js Web Development Using Sails.js Presented by Eric Nograles, Analytics Practice Champion/Senior Consultant

Upload: agilethought

Post on 14-Jun-2015

5.096 views

Category:

Technology


9 download

DESCRIPTION

End-to-end JavaScript web applications? Thanks to Node.js, this has become a reality, with the added benefit of massive scalability. Despite approaching server-side web applications differently than traditional MVC platforms (like ASP .Net MVC), frameworks have emerged to bridge the knowledge to Node.js. Using one of these frameworks, Sails.js, we demonstrate how the tried and true MVC pattern is applied in Node.js. http://agilethought.com

TRANSCRIPT

Page 1: Node.js Web Development Using Sails

MEAN Sailing: Node.js Web Development Using Sails.jsPresented by Eric Nograles, Analytics Practice Champion/Senior Consultant

Page 2: Node.js Web Development Using Sails

Why So MEAN?

• Designed with scalability in mind• Measured ~10,000 concurrent connections

on 3 small EC2 instances

• Unified front and back-end language: minimal context-switching

• Higher productivity

• Greater development velocity

• Happy developers and happy product owners

• JavaScript has grown up

Page 3: Node.js Web Development Using Sails

Meet Node.js

• Server-side JavaScript (yes, JavaScript)

• Runs on Chrome’s V8 JavaScript Engine

• Single-threaded, non-blocking and event-driven

• Designed for the real-time web with push capability

• Web application framework: Express

• .Net = IIS

• Java = JBoss

Page 4: Node.js Web Development Using Sails

Node on Sails!

• Just kidding, it’s just Sails

• MVC Framework built on Node.js and Express• .Net = ASP .Net MVC

• Java = Spring MVC

• Inspired by Ruby on Rails

• Prepackaged solution of libraries: ORM, Socket.io, template engine, data store adapters

• A natural fit with MongoDB

www.agilethought.com

Page 5: Node.js Web Development Using Sails

Where Do We Lift Sails?

www.agilethought.com

Page 6: Node.js Web Development Using Sails

It’s Literally This Simple to Start…1. npm install –g sails2. sails new [application name]3. cd [application name directory]4. sails lift

www.agilethought.com

Page 7: Node.js Web Development Using Sails

A Simple, Pattern-based Structure

• /api: Developer magic happens here

• /assets: UI/UX wizardry

• /config: Get your Sails app to behave

• /views: More UI/UX wizardry

• App.js: Node.js debugging front-door

• Gruntfile.js: Build and task

automation

WebStorm View…

www.agilethought.com

Page 8: Node.js Web Development Using Sails

Familiar Techniques

Separation of Concerns: Modular JS Patterns

Domain Models: Waterline ORM and POJSO’s

Dependency Injection: RequireJS

Unit Testing/Mocking: Mocha, Chai, Sinon, and Proxyquire

Build and Task Automation: Grunt

Dependency Management: NPM

www.agilethought.com

Page 9: Node.js Web Development Using Sails

Know MVC? Know Sails!

Models ControllersBusiness Logic

www.agilethought.com

Page 10: Node.js Web Development Using Sails

Pro-Tips for Learning Sails

Know jQuery? Awesome. Forget about it.

Focus on architectural patterns + practices (i.e. “How would this be done in

MVC?”)

Understand how asynchronous development and Promises work in

JavaScript.

Get to know JavaScript “quirks” and its OOP capabilities

Use WebStorm as an IDE to ease the learning curve (from .Net and Java)

www.agilethought.com

Page 11: Node.js Web Development Using Sails

When to Sail?

Real-time Web Applications (Chat, “Live” Dashboards)

Server API for an Object DB (CRUD, Heavy I/O)

Queued Applications (Logging, “eventual consistency” solutions)

Quick Prototyping (for Server API’s, Proxies, etc.)

www.agilethought.com

Page 12: Node.js Web Development Using Sails

Cloud Deployment Options

• Joyent: http://www.joyent.com/

• Amazon Web Services: http://aws.amazon.com/

• NodeJitsu: https://www.nodejitsu.com/

www.agilethought.com

Page 13: Node.js Web Development Using Sails

Sample Sources

• GitHub: https://github.com/ericnograles/agilemoviedb

• NGBP: https://github.com/ngbp/ngbp

• StartBootstrap Stylish Portfolio: http://startbootstrap.com/stylish-portfolio

www.agilethought.com

Page 14: Node.js Web Development Using Sails

Check Out Our Recorded Webinars

Recorded ALM Webinars: http://www.agilethought.com/library

• Webinar: 5 TFS Features That Will Dramatically Improve Your Team's Performance

• Webinar: 6 Steps To Achieving Predictable Release Management With Visual Studio 2013

• Webinar: How To Create High Value Development Teams

Upcoming Events: http://www.agilethought.com/events

www.agilethought.com

Page 15: Node.js Web Development Using Sails

Eric Nograles is a Senior Consultant and Analytics Practice Champion at AgileThought. Having 15

years of leading and executing multi-platform enterprise development, he takes particular interest

in Business Intelligence, big data, and modern web frameworks (Node.js and AngularJS).

About Eric

Thank You!

@grales

Looking For Software Solutions For Your Business? Email me at [email protected] 15

linkedin.com/in/ericnograles