Frameworks Galore

NodeJS

Express.js

  • Since 09/2012
  • Convention-over-Configuration
  • Command-line Scaffold Generator
  • Waterline ORM
  • Integrates Web Sockets
  • Bundles Static Files with Grunt 

 

  • Since 08/2011
  • Configuration-Centric
  • Designed for APIs
  • Validation using JOI Module
  • Built-in Authentication

 

  • Since 09/2013
  • SEO Compliance
  • Powered by Hapi.js
  • Require.js, Backbone, jQuery, Handlebars
  • HTML5's pushState 

 

Code Examples

WATERLINE ORM

var Model = {
  attributes: {
  	title: {
  	  type: 'string',
  	  required: true
  	}
        count: {
          type: 'integer',
          defaultTo: 1
        }
  }
}

mysql • mongo • redis • postgres • ldap • neo4js

Controller

exports.index = function(req, res){
  res.render('index', { title: 'Home' })
}

exports.list = function(req, res, next){
  if (error) return next(error)
  res.redirect('/tasks')
}

Express.js

Controller

module.exports = {
  hi: function (req, res) {
    return res.send("Hi there!");
  },
  bye: function (req, res) {
    return res.redirect("http://www.url.com");
  }
}
exports.index = function(req, res){
  res.render('index', { title: 'Home' })
}

exports.list = function(req, res, next){
  if (error) return next(error)
  res.redirect('/tasks')
}

Express.js

Server

Express.js

var http = require('http')
http.createServer(app).listen(app.get('port'), 
  function(){
    console.log('Listening on port ' + app.get('port'))
  }
)
app.get('/', routes.index)

Server

var server = new Hapi.Server()
server.start(function () {
    console.log('Server started at: ' + server.info.uri)
})
server.route({
    path: '/', 
    method: 'GET',
    handler: showIndex
})

Express.js

var http = require('http')
http.createServer(app).listen(app.get('port'), 
  function(){
    console.log('Listening on port ' + app.get('port'))
  }
)
app.get('/', routes.index)

Server

define(['lazoServer'], function (LazoServer) {
    return LazoServer.extend({
        setup: function (hapi, pack, servers, options) {
            pack.register({
                plugin: require('good'),
                options: {
                    ...
                }
            }, function (err) {
                if (err) {
                    LAZO.logger.error('[server.setup]', 'Error: ' + err)
                } else {
                    LAZO.logger.info('[server.setup]', 'Monitoring:')
                    options.success()
                }
            })
        }
    })
})

Anatomy

/assets
 
/public

/config

/view

/api
/app.js

/public

/routes

/views

Express.js

Anatomy

/assets
 
/public

/config

/view

/api
/app

/component

/models
/app.js

/public

/routes

/views

Express.js

/public
--> img
--> css
--> js

/server
--> config
--> controllers
--> models
--> views

Full-Stack
 

SEO by URI Routes

 

 

 

 

 

 

Easier + Configurable HTTP Server I/O • Scaffolding

 

HTTP Server I/O

MVC • DB Adapters
Integrated Sockets • ORM
 

API Optimized
Built-in Auth • Config+
 

Express.js

NodeJS Frameworks

By Tom

NodeJS Frameworks

  • 218
Loading comments...

More from Tom