KEMBAR78
Academy PRO: Node.js alternative stacks. Lecture 3 | PPTX
Academy PRO
Node.js
Alternative Stacks
Lectures plan
1. Node.js Platform
2. Web applications - Default stack
3. Web applications - Alternative stacks
4. Node.js in Production
5. Miscellaneous
koa
TJ Holowaychuk
JS fatigue HTTP
Routers
Controllers
Services
Repositories
Models
koa()
Context
Application
Request
Response
koa-generator
koa2-generator
koa
co - coroutines
koa v2 - async/await
npm i -S koa@next
node --harmony ./
koa-convert
Koa - Routing
Koa - Middleware
koa-static
koa-bodyparser
koa-session
koa App
http://192.168.1.191:3333
https://github.com/msemenistyi/nodejs-bsapro-misc/tree/master/backend/koa
Koa: pros and cons
Pros:
Minimalistic
Graceful async
Cons:
Interesting community
Interesting community
hapi
Eran Hammer
2011 HTTP
Routers
Controllers
Services
Repositories
Models
Hapi - hello
Hapi - router
Hapi - plugins
Hapi - validation
Joi
Hapi - authentication
Hapi App
http://192.168.1.191:7777
https://github.com/msemenistyi/nodejs-bsapro-misc/tree/master/backend/hapi
hapi - pros and cons
Pros:
Minimalistic
Cons:
Small community
Sails
HTTP
Routers
Controllers
Services
Repositories
Models
Mike McNeil
2012
Rails
Sails new app
npm i -S sails
sails new sails
sails lift
Sails - generators
to standardize conventions and boilerplate logic for all new apps across
your organization
to override the default Gruntfile with a set of custom tasks
to completely replace Grunt with Gulp or webpack
to use another view engine like Jade, Dust or Nunjucks by default (instead of
EJS)
to automate custom deployments (e.g. white label apps with one server per-
customer)
to generate files as Coffeescript or Typescript
Sails - Configurations
Sails - Blueprints
sails generate api user
● find GET /:model
● findOne GET /:model/:id
● create POST /:model
● update PUT /:model/:id
● destroy DELETE /:model/:id
● populate GET /:model/:id/:association
● add POST /:model/:id/:association/:fk
● remove DELETE
/:model/:id/:association/:fk
Sails - Waterline
PostgreSQL
MySQL
MongoDB
Memory
Disk
Microsoft SQL Server
Redis
Riak
Neo4j
OrientDB
ArangoDB
Apache Cassandra
GraphQL
Solr
Apache Derby
Sails - Model
Sails - WebSockets
Sails - misc
I18n
Policies - auth
Security
So sweet
Not so sweet
Sails App
http://192.168.1.191:5555
https://github.com/msemenistyi/nodejs-bsapro-misc/tree/master/backend/sails
Sails App
http://192.168.1.191:5555
https://github.com/msemenistyi/nodejs-bsapro-misc/tree/master/backend/sails
Sails - pros and cons
Pros:
Swiss-army knife
Though-through scenarious
Cons:
v0.12; v1.0 comming soon
Cumbersome
Rails copycat
Configuration over convention over
configuration
LoopBack
StrongLoop
HTTP
Routers
Controllers
Services
Repositories
Models
Loopback - yo
Loopback - hello
Loopback - models
Loopback - Swagger
Loopback - Explorer
Loopback - middleware
Loopback - misc
Authentication, authorization
Pubsub
Remote methods, remote hooks, operation hooks
● access
● before save
● after save
● before delete
● after delete
● loaded
● persist
Loopback - arch
● iOS SDK
● Android SDK
● AngularJS SDK
● Xamarin SDK
● Isomorphic LoopBack
LoopBack App
http://192.168.1.191:8888
https://github.com/msemenistyi/nodejs-bsapro-
misc/tree/master/backend/loopback
LoopBack - pros and cons
Pros:
High ROI
Lots of integrations
Cons:
Rather high entry barrier
Vendor lock-in
Academy PRO: Node.js alternative stacks. Lecture 3

Academy PRO: Node.js alternative stacks. Lecture 3