SlideShare a Scribd company logo
seneca
 nodejsdublin
16 August 2012

Richard Rodger
   @rjrodger
hello
nodejsdublin
 • let's start a community project
 • how Node.js modules work
 • introducing the seneca module
getting
    started
• how do you learn Node.js?
• how do you contribute to Node.js?
• how do you get a job doing Node.js?
your
community
• nodejsdublin is for you
• here to help you learn
• here to build a great community
let's start
 a project
• less talking, more coding!
• community project with many coders
• something with lots of small pieces
seneca
• A Minimal Viable Product toolkit
• let's you build a startup in a weekend :)
• for more about MVPs: http://bit.ly/N25FlZ
• Lucius Annaeus Seneca, 4 BC – AD 65
• You have to be stoic to do a startup
• "increases are of sluggish growth, but the way to
  ruin is rapid"
                             * http://cassandralegacy.blogspot.ie/2011/08/seneca-effect-origins-of-collapse.html
sign up
• Tweet @nodejsdublin with #seneca
• Mail me: richard.rodger@nearform.com
• Code: github.com/nodejsdublin/seneca
node.js
   modules
• basic building blocks of Node.js apps
• no special syntax; plain old JavaScript
• no version conflicts!
using modules

var _ = require("underscore");

var threes = _.map([1, 2, 3], function(n){ return n*3 });
console.log( threes );
// prints [3, 6, 9]



var mongo = require('mongodb');

var host = 'localhost';
var port = 27017;

var db   = new mongo.Db( 'mydatabase',
  new mongo.Server(host, port, {}), {});

db.open(function(err, db) { ... }
cool
        modules
• express - JSP/ASP style dynamic server-side pages
• socket.io - HTML5 real-time web sockets that "just work"
• request - easy outbound calls to web services
using npm
• npmjs.org - module repository of record
• usage: npm install modulename
• modules live in local node_modules folder
how to pick
 a module
•   serious modules are on https://github.com/joyent/node/wiki/modules
•   popularity! check watchers/issues on github
•   documentation, including third party blogs
•   ask the community: http://nodejs.org/community/
why npm
  rocks
• modules are installed separately for each project
• dependencies are also installed separately
• no global conflicts, no cross-dependency
  conflicts
package.json
 • defines a module; lists dependencies
 • always create one for each project
 • npm install will set up dependencies for you!
package.json
{
  "name"         : "optimist",
  "version"      : "0.3.4",
  "description" : "Light-weight option parsing.",
  "main"         : "./index.js",
 
  "dependencies" : {
     "wordwrap" : ">=0.0.2"
  },

  "repository"   : {
    "type" : "git",
    "url" : "http://github.com/substack/node-optimist.git"
  },

  "keywords"    : [ "argument", "args", "option", "parser" ]
  "author"      : { "name" : "James Halliday" },
  "engine"      : { "node" : ">=0.4 }
}
write a
    module
• create a project on github
• npm init - creates package.json for you
• start with lib/modulename.js
modulename.js
"use strict";

function ModuleName() {
  var self = {};

    var private = "hidden";

    self.member = "data";

    self.method = function() { ... };

    return self;
}

exports.ModuleName = ModuleName


                     callingcode.js
    var modulename = require('modulename')

    var instance = new modulename.ModuleName()
parambulator
•   written just for this meetup! - sanity checks JSON data structures
•   https://github.com/rjrodger/parambulator
•   you also need a README.md and LICENSE.txt
•   you really should have unit tests; try the vows module
file structure
parambulator /

      package.json

      README.md

      LICENSE.txt

      lib /

         parambulator.js
publishing a
  module
• the package.json files property is your friend
• register for an account on npmjs.org
• npm publish
• sit back and bask in the glory...
seneca
• nearForm builds web/mobile services
• shared set of features every startup needs
• ... must resist ... let's build a framework!
shared
     features
•   user accounts: login/logout, profile pages, social media, ...
•   email: transactional, promotional, ...
•   e-commerce: gateways, app stores, ...
•   admin: data editors, analytics, audit logs, ..
seneca is in
  production

businesspost.ie   chartaca.com   stanzr.com
command
 pattern
•   actions are represented by a set of properties
•   seneca "executes" them by invoking plugins
•   everything that happens is traceable
•   business logic is insulated from service providers
seneca commands
// register a new user
seneca.act({
   on:       'user',
   cmd:      'register',
   email:    'alice@example.com',
   name:     'Alice',
   password: '1234',
   active:   true
},
function(err, result) { ... })


// send an email
seneca.act({
   on:       'email',
   cmd:      'send',
   to:       'alice@example.com',
   code:     'thanks-for-registering',
   fields:   {name:'Alice'}
},
function(err, result) { ... })
plugins
• everything is a plugin
• plugins provide actions
• plugins are just modules!
seneca plugin
function EchoPlugin() {
  var self = {};
  self.name = 'echo';

    self.init = function(seneca,opts,cb) {

        seneca.add({on:'echo'}, function(args,seneca,cb){
           var out = args
           cb(null,out)
        })

        cb()
    }

    self.service = function() {
      return function(req,res,next){
        if( '/echo' == req.url ) {
          res.writeHead(200);
          res.end(req.url);
        }
        else next();
      }
    }
}

exports.plugin = function() {
  return new EchoPlugin()
}
shared
data model
• Built-in ODM - Object Document Mapper
• You need this to stay sane
• ActiveRecord-ish API with MongoDB-ish queries
seneca data model
var product = seneca.make('product');

product.name = 'Apple';
product.price = 1.99;

product.save$(function(err,savedproduct){
   console.log('generated id: '+savedproduct.id);
})

product.load$('1234',function(err,foundproduct){
   console.log('found product '+foundproduct);
})

product.list$( {price:1.99}, function(err,list){
   for( var i = 0; i < list.length; i++ ) {
     console.log( list[i] );
   }
})
what we
•
 have now
  messy code that kinda sorta works
• a few hackety hack plugins
• no documentation!
what we
     need
• plugins! plugins! plugins!
• documentation ( ... just kidding! I'll do that)
• some nodeknockout.com entries -
   November 10-12th! Fame & Glory Await!
let's code!
• Tweet @nodejsdublin with #seneca
• Mail me: richard.rodger@nearform.com
• Code: github.com/nodejsdublin/seneca

More Related Content

What's hot

Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
Rafal Gancarz
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
Tom Croucher
 
NodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin WayNodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin Way
Edureka!
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialTom Croucher
 
Construindo APIs Usando Rails
Construindo APIs Usando RailsConstruindo APIs Usando Rails
Construindo APIs Usando Rails
Fernando Kakimoto
 
Nuxt.js - Introduction
Nuxt.js - IntroductionNuxt.js - Introduction
Nuxt.js - Introduction
Sébastien Chopin
 
.NET Conf 2018: Build Great Libraries using .NET Standard
.NET Conf 2018: Build Great Libraries using .NET Standard.NET Conf 2018: Build Great Libraries using .NET Standard
.NET Conf 2018: Build Great Libraries using .NET Standard
Immo Landwerth
 
Building a production ready meteor app
Building a production ready meteor appBuilding a production ready meteor app
Building a production ready meteor appRitik Malhotra
 
Node js training (1)
Node js training (1)Node js training (1)
Node js training (1)
Ashish Gupta
 
Nuxt Talk
Nuxt TalkNuxt Talk
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serialization
GWTcon
 
Building Real-Time Applications with Android and WebSockets
Building Real-Time Applications with Android and WebSocketsBuilding Real-Time Applications with Android and WebSockets
Building Real-Time Applications with Android and WebSockets
Sergi Almar i Graupera
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful APISang Cù
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
Brian Shannon
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Java
Clément Escoffier
 
Sails.js Intro
Sails.js IntroSails.js Intro
Sails.js Intro
Nicholas Jansma
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvars
Sam Marley-Jarrett
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
Ahmed AbouZaid
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
Amit Thakkar
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and Packer
George Miranda
 

What's hot (20)

Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
 
NodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin WayNodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin Way
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
Construindo APIs Usando Rails
Construindo APIs Usando RailsConstruindo APIs Usando Rails
Construindo APIs Usando Rails
 
Nuxt.js - Introduction
Nuxt.js - IntroductionNuxt.js - Introduction
Nuxt.js - Introduction
 
.NET Conf 2018: Build Great Libraries using .NET Standard
.NET Conf 2018: Build Great Libraries using .NET Standard.NET Conf 2018: Build Great Libraries using .NET Standard
.NET Conf 2018: Build Great Libraries using .NET Standard
 
Building a production ready meteor app
Building a production ready meteor appBuilding a production ready meteor app
Building a production ready meteor app
 
Node js training (1)
Node js training (1)Node js training (1)
Node js training (1)
 
Nuxt Talk
Nuxt TalkNuxt Talk
Nuxt Talk
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serialization
 
Building Real-Time Applications with Android and WebSockets
Building Real-Time Applications with Android and WebSocketsBuilding Real-Time Applications with Android and WebSockets
Building Real-Time Applications with Android and WebSockets
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful API
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Java
 
Sails.js Intro
Sails.js IntroSails.js Intro
Sails.js Intro
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvars
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and Packer
 

Viewers also liked

Richard rodger technical debt - web summit 2013
Richard rodger   technical debt - web summit 2013Richard rodger   technical debt - web summit 2013
Richard rodger technical debt - web summit 2013
Richard Rodger
 
Rapid Digital Innovation: How Node.js Delivers
Rapid Digital Innovation: How Node.js DeliversRapid Digital Innovation: How Node.js Delivers
Rapid Digital Innovation: How Node.js Delivers
Richard Rodger
 
How microservices fail, and what to do about it
How microservices fail, and what to do about itHow microservices fail, and what to do about it
How microservices fail, and what to do about it
Richard Rodger
 
Meet song nhi your virtual financial assistance
Meet song nhi   your virtual financial assistanceMeet song nhi   your virtual financial assistance
Meet song nhi your virtual financial assistance
Designveloper
 
Microservices and Seneca at RomaJS group
Microservices and Seneca at RomaJS groupMicroservices and Seneca at RomaJS group
Microservices and Seneca at RomaJS group
Luca Lanziani
 
The Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 ConferenceThe Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 Conference
Richard Rodger
 
Node Interactive : 7 years, 7 design patterns, will node continue to outshine
Node Interactive : 7 years, 7 design patterns, will node continue to outshineNode Interactive : 7 years, 7 design patterns, will node continue to outshine
Node Interactive : 7 years, 7 design patterns, will node continue to outshine
Shubhra Kar
 
NodeJS Microservices, Built it Now, Scale it Later!
NodeJS Microservices, Built it Now, Scale it Later!NodeJS Microservices, Built it Now, Scale it Later!
NodeJS Microservices, Built it Now, Scale it Later!
Lalit Shandilya
 
Writing Test Cases with PHPUnit
Writing Test Cases with PHPUnitWriting Test Cases with PHPUnit
Writing Test Cases with PHPUnit
Shouvik Chatterjee
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
William Bruno Moraes
 
Building Web Apps & APIs With Node JS
Building Web Apps & APIs With Node JSBuilding Web Apps & APIs With Node JS
Building Web Apps & APIs With Node JS
Lohith Goudagere Nagaraj
 
NodeJS security - still unsafe at most speeds - v1.0
NodeJS security - still unsafe at most speeds - v1.0NodeJS security - still unsafe at most speeds - v1.0
NodeJS security - still unsafe at most speeds - v1.0
Dinis Cruz
 
Asynchronous I/O in NodeJS - new standard or challenges?
Asynchronous I/O in NodeJS - new standard or challenges?Asynchronous I/O in NodeJS - new standard or challenges?
Asynchronous I/O in NodeJS - new standard or challenges?Dinh Pham
 
Patterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesPatterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservices
Rachel Reese
 
Testing NodeJS Security
Testing NodeJS SecurityTesting NodeJS Security
Testing NodeJS Security
Jose Manuel Ortega Candel
 
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Steve Pember
 
Microservices Past, Present, Future
Microservices Past, Present, FutureMicroservices Past, Present, Future
Microservices Past, Present, Future
David Dawson
 
Bizweb Microservices Architecture
Bizweb Microservices ArchitectureBizweb Microservices Architecture
Bizweb Microservices Architecture
Khôi Nguyễn Minh
 
ITLC HN 14 - Bizweb Microservices Architecture
ITLC HN 14  - Bizweb Microservices ArchitectureITLC HN 14  - Bizweb Microservices Architecture
ITLC HN 14 - Bizweb Microservices Architecture
IT Expert Club
 
Distributed Transaction in Microservice
Distributed Transaction in MicroserviceDistributed Transaction in Microservice
Distributed Transaction in Microservice
Nghia Minh
 

Viewers also liked (20)

Richard rodger technical debt - web summit 2013
Richard rodger   technical debt - web summit 2013Richard rodger   technical debt - web summit 2013
Richard rodger technical debt - web summit 2013
 
Rapid Digital Innovation: How Node.js Delivers
Rapid Digital Innovation: How Node.js DeliversRapid Digital Innovation: How Node.js Delivers
Rapid Digital Innovation: How Node.js Delivers
 
How microservices fail, and what to do about it
How microservices fail, and what to do about itHow microservices fail, and what to do about it
How microservices fail, and what to do about it
 
Meet song nhi your virtual financial assistance
Meet song nhi   your virtual financial assistanceMeet song nhi   your virtual financial assistance
Meet song nhi your virtual financial assistance
 
Microservices and Seneca at RomaJS group
Microservices and Seneca at RomaJS groupMicroservices and Seneca at RomaJS group
Microservices and Seneca at RomaJS group
 
The Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 ConferenceThe Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 Conference
 
Node Interactive : 7 years, 7 design patterns, will node continue to outshine
Node Interactive : 7 years, 7 design patterns, will node continue to outshineNode Interactive : 7 years, 7 design patterns, will node continue to outshine
Node Interactive : 7 years, 7 design patterns, will node continue to outshine
 
NodeJS Microservices, Built it Now, Scale it Later!
NodeJS Microservices, Built it Now, Scale it Later!NodeJS Microservices, Built it Now, Scale it Later!
NodeJS Microservices, Built it Now, Scale it Later!
 
Writing Test Cases with PHPUnit
Writing Test Cases with PHPUnitWriting Test Cases with PHPUnit
Writing Test Cases with PHPUnit
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
 
Building Web Apps & APIs With Node JS
Building Web Apps & APIs With Node JSBuilding Web Apps & APIs With Node JS
Building Web Apps & APIs With Node JS
 
NodeJS security - still unsafe at most speeds - v1.0
NodeJS security - still unsafe at most speeds - v1.0NodeJS security - still unsafe at most speeds - v1.0
NodeJS security - still unsafe at most speeds - v1.0
 
Asynchronous I/O in NodeJS - new standard or challenges?
Asynchronous I/O in NodeJS - new standard or challenges?Asynchronous I/O in NodeJS - new standard or challenges?
Asynchronous I/O in NodeJS - new standard or challenges?
 
Patterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesPatterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservices
 
Testing NodeJS Security
Testing NodeJS SecurityTesting NodeJS Security
Testing NodeJS Security
 
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...
 
Microservices Past, Present, Future
Microservices Past, Present, FutureMicroservices Past, Present, Future
Microservices Past, Present, Future
 
Bizweb Microservices Architecture
Bizweb Microservices ArchitectureBizweb Microservices Architecture
Bizweb Microservices Architecture
 
ITLC HN 14 - Bizweb Microservices Architecture
ITLC HN 14  - Bizweb Microservices ArchitectureITLC HN 14  - Bizweb Microservices Architecture
ITLC HN 14 - Bizweb Microservices Architecture
 
Distributed Transaction in Microservice
Distributed Transaction in MicroserviceDistributed Transaction in Microservice
Distributed Transaction in Microservice
 

Similar to Introducing the Seneca MVP framework for Node.js

Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io
 
Node azure
Node azureNode azure
Node azure
Emanuele DelBono
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
Chris Cowan
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
Yoann Gotthilf
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
cacois
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
soft-shake.ch
 
SwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupSwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup Group
Ernest Jumbe
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
Mariusz Nowak
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
Kris Buytaert
 
Node.js
Node.jsNode.js
Node.js
Ian Oxley
 
1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb
Leo Zhou
 
Logstash
LogstashLogstash
Logstash
琛琳 饶
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
David Padbury
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS偉格 高
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
 

Similar to Introducing the Seneca MVP framework for Node.js (20)

Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
Node azure
Node azureNode azure
Node azure
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
Django at Scale
Django at ScaleDjango at Scale
Django at Scale
 
SwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupSwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup Group
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Node.js
Node.jsNode.js
Node.js
 
1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb
 
Logstash
LogstashLogstash
Logstash
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 

More from Richard Rodger

Using RAG to create your own Podcast conversations.pdf
Using RAG to create your own Podcast conversations.pdfUsing RAG to create your own Podcast conversations.pdf
Using RAG to create your own Podcast conversations.pdf
Richard Rodger
 
Richard_TheDev2023_pattern.pptx.pdf
Richard_TheDev2023_pattern.pptx.pdfRichard_TheDev2023_pattern.pptx.pdf
Richard_TheDev2023_pattern.pptx.pdf
Richard Rodger
 
richard-rodger-awssofia-microservices-2019.pdf
richard-rodger-awssofia-microservices-2019.pdfrichard-rodger-awssofia-microservices-2019.pdf
richard-rodger-awssofia-microservices-2019.pdf
Richard Rodger
 
richardrodger-microservice-algebra-cluj-apr.pdf
richardrodger-microservice-algebra-cluj-apr.pdfrichardrodger-microservice-algebra-cluj-apr.pdf
richardrodger-microservice-algebra-cluj-apr.pdf
Richard Rodger
 
richardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdfrichardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdf
Richard Rodger
 
richardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdfrichardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdf
Richard Rodger
 
richardrodger-microservice-risk-dublin-mar.pdf
richardrodger-microservice-risk-dublin-mar.pdfrichardrodger-microservice-risk-dublin-mar.pdf
richardrodger-microservice-risk-dublin-mar.pdf
Richard Rodger
 
richardrodger-service-discovery-waterford-feb.pdf
richardrodger-service-discovery-waterford-feb.pdfrichardrodger-service-discovery-waterford-feb.pdf
richardrodger-service-discovery-waterford-feb.pdf
Richard Rodger
 
richardrodger-vespa-waterford-oct.pdf
richardrodger-vespa-waterford-oct.pdfrichardrodger-vespa-waterford-oct.pdf
richardrodger-vespa-waterford-oct.pdf
Richard Rodger
 
Richardrodger designing-microservices-uxdx-dublin-oct
Richardrodger designing-microservices-uxdx-dublin-octRichardrodger designing-microservices-uxdx-dublin-oct
Richardrodger designing-microservices-uxdx-dublin-oct
Richard Rodger
 
Richardrodger nodeconfeu-2014-final
Richardrodger nodeconfeu-2014-finalRichardrodger nodeconfeu-2014-final
Richardrodger nodeconfeu-2014-final
Richard Rodger
 
Richardrodger nodeday-2014-final
Richardrodger nodeday-2014-finalRichardrodger nodeday-2014-final
Richardrodger nodeday-2014-final
Richard Rodger
 
Richardrodger nodeday-2014-final
Richardrodger nodeday-2014-finalRichardrodger nodeday-2014-final
Richardrodger nodeday-2014-final
Richard Rodger
 
Richardrodger microxchgio-feb-2015-final
Richardrodger microxchgio-feb-2015-finalRichardrodger microxchgio-feb-2015-final
Richardrodger microxchgio-feb-2015-final
Richard Rodger
 
Micro-services Battle Scars
Micro-services Battle ScarsMicro-services Battle Scars
Micro-services Battle Scars
Richard Rodger
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.jsRichard Rodger
 
How to Write Big Apps (Richard Rodger NodeDublin 2012)
How to Write Big Apps (Richard Rodger NodeDublin 2012)How to Write Big Apps (Richard Rodger NodeDublin 2012)
How to Write Big Apps (Richard Rodger NodeDublin 2012)Richard Rodger
 
Richard rodger-appgen-2012-lxjs-lisbon
Richard rodger-appgen-2012-lxjs-lisbonRichard rodger-appgen-2012-lxjs-lisbon
Richard rodger-appgen-2012-lxjs-lisbonRichard Rodger
 

More from Richard Rodger (20)

Using RAG to create your own Podcast conversations.pdf
Using RAG to create your own Podcast conversations.pdfUsing RAG to create your own Podcast conversations.pdf
Using RAG to create your own Podcast conversations.pdf
 
Richard_TheDev2023_pattern.pptx.pdf
Richard_TheDev2023_pattern.pptx.pdfRichard_TheDev2023_pattern.pptx.pdf
Richard_TheDev2023_pattern.pptx.pdf
 
richard-rodger-awssofia-microservices-2019.pdf
richard-rodger-awssofia-microservices-2019.pdfrichard-rodger-awssofia-microservices-2019.pdf
richard-rodger-awssofia-microservices-2019.pdf
 
richardrodger-microservice-algebra-cluj-apr.pdf
richardrodger-microservice-algebra-cluj-apr.pdfrichardrodger-microservice-algebra-cluj-apr.pdf
richardrodger-microservice-algebra-cluj-apr.pdf
 
richardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdfrichardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdf
 
richardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdfrichardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdf
 
richardrodger-microservice-risk-dublin-mar.pdf
richardrodger-microservice-risk-dublin-mar.pdfrichardrodger-microservice-risk-dublin-mar.pdf
richardrodger-microservice-risk-dublin-mar.pdf
 
richardrodger-service-discovery-waterford-feb.pdf
richardrodger-service-discovery-waterford-feb.pdfrichardrodger-service-discovery-waterford-feb.pdf
richardrodger-service-discovery-waterford-feb.pdf
 
richardrodger-vespa-waterford-oct.pdf
richardrodger-vespa-waterford-oct.pdfrichardrodger-vespa-waterford-oct.pdf
richardrodger-vespa-waterford-oct.pdf
 
Richardrodger designing-microservices-uxdx-dublin-oct
Richardrodger designing-microservices-uxdx-dublin-octRichardrodger designing-microservices-uxdx-dublin-oct
Richardrodger designing-microservices-uxdx-dublin-oct
 
Richardrodger nodeconfeu-2014-final
Richardrodger nodeconfeu-2014-finalRichardrodger nodeconfeu-2014-final
Richardrodger nodeconfeu-2014-final
 
Richardrodger nodeday-2014-final
Richardrodger nodeday-2014-finalRichardrodger nodeday-2014-final
Richardrodger nodeday-2014-final
 
Richardrodger nodeday-2014-final
Richardrodger nodeday-2014-finalRichardrodger nodeday-2014-final
Richardrodger nodeday-2014-final
 
Richardrodger microxchgio-feb-2015-final
Richardrodger microxchgio-feb-2015-finalRichardrodger microxchgio-feb-2015-final
Richardrodger microxchgio-feb-2015-final
 
Micro-services Battle Scars
Micro-services Battle ScarsMicro-services Battle Scars
Micro-services Battle Scars
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.js
 
How to Write Big Apps (Richard Rodger NodeDublin 2012)
How to Write Big Apps (Richard Rodger NodeDublin 2012)How to Write Big Apps (Richard Rodger NodeDublin 2012)
How to Write Big Apps (Richard Rodger NodeDublin 2012)
 
Richard rodger-appgen-2012-lxjs-lisbon
Richard rodger-appgen-2012-lxjs-lisbonRichard rodger-appgen-2012-lxjs-lisbon
Richard rodger-appgen-2012-lxjs-lisbon
 
20120802 timisoara
20120802 timisoara20120802 timisoara
20120802 timisoara
 
20120816 nodejsdublin
20120816 nodejsdublin20120816 nodejsdublin
20120816 nodejsdublin
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 

Introducing the Seneca MVP framework for Node.js

  • 1. seneca nodejsdublin 16 August 2012 Richard Rodger @rjrodger
  • 2. hello nodejsdublin • let's start a community project • how Node.js modules work • introducing the seneca module
  • 3. getting started • how do you learn Node.js? • how do you contribute to Node.js? • how do you get a job doing Node.js?
  • 4. your community • nodejsdublin is for you • here to help you learn • here to build a great community
  • 5. let's start a project • less talking, more coding! • community project with many coders • something with lots of small pieces
  • 6. seneca • A Minimal Viable Product toolkit • let's you build a startup in a weekend :) • for more about MVPs: http://bit.ly/N25FlZ
  • 7. • Lucius Annaeus Seneca, 4 BC – AD 65 • You have to be stoic to do a startup • "increases are of sluggish growth, but the way to ruin is rapid" * http://cassandralegacy.blogspot.ie/2011/08/seneca-effect-origins-of-collapse.html
  • 8. sign up • Tweet @nodejsdublin with #seneca • Mail me: richard.rodger@nearform.com • Code: github.com/nodejsdublin/seneca
  • 9. node.js modules • basic building blocks of Node.js apps • no special syntax; plain old JavaScript • no version conflicts!
  • 10. using modules var _ = require("underscore"); var threes = _.map([1, 2, 3], function(n){ return n*3 }); console.log( threes ); // prints [3, 6, 9] var mongo = require('mongodb'); var host = 'localhost'; var port = 27017; var db = new mongo.Db( 'mydatabase', new mongo.Server(host, port, {}), {}); db.open(function(err, db) { ... }
  • 11. cool modules • express - JSP/ASP style dynamic server-side pages • socket.io - HTML5 real-time web sockets that "just work" • request - easy outbound calls to web services
  • 12. using npm • npmjs.org - module repository of record • usage: npm install modulename • modules live in local node_modules folder
  • 13. how to pick a module • serious modules are on https://github.com/joyent/node/wiki/modules • popularity! check watchers/issues on github • documentation, including third party blogs • ask the community: http://nodejs.org/community/
  • 14. why npm rocks • modules are installed separately for each project • dependencies are also installed separately • no global conflicts, no cross-dependency conflicts
  • 15. package.json • defines a module; lists dependencies • always create one for each project • npm install will set up dependencies for you!
  • 16. package.json {   "name" : "optimist",   "version" : "0.3.4",   "description" : "Light-weight option parsing.", "main" : "./index.js",     "dependencies" : {      "wordwrap" : ">=0.0.2"   },   "repository" : {     "type" : "git",     "url" : "http://github.com/substack/node-optimist.git"   },   "keywords" : [ "argument", "args", "option", "parser" ]   "author" : { "name" : "James Halliday" }, "engine" : { "node" : ">=0.4 } }
  • 17. write a module • create a project on github • npm init - creates package.json for you • start with lib/modulename.js
  • 18. modulename.js "use strict"; function ModuleName() { var self = {}; var private = "hidden"; self.member = "data"; self.method = function() { ... }; return self; } exports.ModuleName = ModuleName callingcode.js var modulename = require('modulename') var instance = new modulename.ModuleName()
  • 19. parambulator • written just for this meetup! - sanity checks JSON data structures • https://github.com/rjrodger/parambulator • you also need a README.md and LICENSE.txt • you really should have unit tests; try the vows module
  • 20. file structure parambulator / package.json README.md LICENSE.txt lib / parambulator.js
  • 21. publishing a module • the package.json files property is your friend • register for an account on npmjs.org • npm publish • sit back and bask in the glory...
  • 22. seneca • nearForm builds web/mobile services • shared set of features every startup needs • ... must resist ... let's build a framework!
  • 23. shared features • user accounts: login/logout, profile pages, social media, ... • email: transactional, promotional, ... • e-commerce: gateways, app stores, ... • admin: data editors, analytics, audit logs, ..
  • 24. seneca is in production businesspost.ie chartaca.com stanzr.com
  • 25. command pattern • actions are represented by a set of properties • seneca "executes" them by invoking plugins • everything that happens is traceable • business logic is insulated from service providers
  • 26. seneca commands // register a new user seneca.act({ on: 'user', cmd: 'register', email: 'alice@example.com', name: 'Alice', password: '1234', active: true }, function(err, result) { ... }) // send an email seneca.act({ on: 'email', cmd: 'send', to: 'alice@example.com', code: 'thanks-for-registering', fields: {name:'Alice'} }, function(err, result) { ... })
  • 27. plugins • everything is a plugin • plugins provide actions • plugins are just modules!
  • 28. seneca plugin function EchoPlugin() { var self = {}; self.name = 'echo'; self.init = function(seneca,opts,cb) { seneca.add({on:'echo'}, function(args,seneca,cb){ var out = args cb(null,out) }) cb() } self.service = function() { return function(req,res,next){ if( '/echo' == req.url ) { res.writeHead(200); res.end(req.url); } else next(); } } } exports.plugin = function() { return new EchoPlugin() }
  • 29. shared data model • Built-in ODM - Object Document Mapper • You need this to stay sane • ActiveRecord-ish API with MongoDB-ish queries
  • 30. seneca data model var product = seneca.make('product'); product.name = 'Apple'; product.price = 1.99; product.save$(function(err,savedproduct){ console.log('generated id: '+savedproduct.id); }) product.load$('1234',function(err,foundproduct){ console.log('found product '+foundproduct); }) product.list$( {price:1.99}, function(err,list){ for( var i = 0; i < list.length; i++ ) { console.log( list[i] ); } })
  • 31. what we • have now messy code that kinda sorta works • a few hackety hack plugins • no documentation!
  • 32. what we need • plugins! plugins! plugins! • documentation ( ... just kidding! I'll do that) • some nodeknockout.com entries - November 10-12th! Fame & Glory Await!
  • 33. let's code! • Tweet @nodejsdublin with #seneca • Mail me: richard.rodger@nearform.com • Code: github.com/nodejsdublin/seneca

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. ...and here&apos;s one we made earlier\n
  6. \n
  7. nero\nseneca squeezes the curve\n\n
  8. \n
  9. \n
  10. \n
  11. \n
  12. intro npm, installed with node\n
  13. \n
  14. \n
  15. \n
  16. explain optimist\n
  17. \n
  18. explain var self = {}\n
  19. blueprint\n
  20. \n
  21. \n
  22. \n
  23. \n
  24. about a year old\n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n