SlideShare una empresa de Scribd logo
1 de 21
A NODE.JS APPLICATION
       Robbie Clutton
NOT ANOTHER NODE.JS
           HELLO WORLD
• An   application built to run on node.js

• Concepts

• Modules   used for the application

• Modules   extracted from the application

• How    dependencies of modules was managed

• Design   decisions made during development

• Hosting
NOT ANOTHER NODE.JS
           HELLO WORLD
• An   application built to run on node.js

• Concepts

• Modules   used for the application

• Modules   extracted from the application

• How    dependencies of modules was managed

• Design   decisions made during development

• Hosting
CONCEPTS



• CommonJS      (http://www.commonjs.org)

• Lint   (http://www.javascriptlint.com/)
NOT ANOTHER NODE.JS
           HELLO WORLD
• An   application built to run on node.js

• Concepts

• Modules   used for the application

• Modules   extracted from the application

• How    dependencies of modules was managed

• Design   decisions made during development

• Hosting
TOOLBOX
• nodejs    - server side javascript vm (http://nodejs.org/)

• connect    - middleware (http://github.com/senchalabs/connect)

• express    - sinatra like routing (http://expressjs.com/)

• ndistro   - dependencies (http://github.com/visionmedia/ndistro)

• ejs   - view templates (http://github.com/visionmedia/ejs)

• mongoose- mongodb driver(http://github.com/LearnBoost/
 mongoose)

• log4js   - logging (http://github.com/csausdev/log4js-node)
CONNECT



• Middleware   framework

• Allowsfilters to be added to HTTP processing (e.g. logging,
 authentication)
CONNECT EXAMPLE
var server = Connect.createServer(
   Connect.logger(),
   function(req, res) {
       res.writeHead(200, {
      'Content-Type': 'text/plain'
      });
       res.end('Hello World');
   }
);
EXPRESS JS

var app = require('express').createServer();
app.get('/', function(req, res){
    res.send('hello world');
});
app.listen(3000);
EJS
res.render('show_username.ejs', {
  locals:{user:user}
});


                 <% if (user) { %>
                   <h2><%= user.name %></h2>
                 <% } %>
MONGOOSE
var mongoose = require('../modules/mongoose/mongoose').Mongoose;
var db = mongoose.connect('mongodb://localhost/tapas');

mongoose.model('User', {
  'properties': ['username', 'password', 'first', 'last', ...],

      'indexes': ['first', 'last', [{'username':1},{unique: true}]],

      'methods': {
         save: function(fn){
            this.updated_at = new Date();
            this.__super__(fn);
         }
       }
});

module.exports = db.model('User');
LOG4JS

var log4js = require('log4js');
log4js.addAppender(log4js.fileAppender('log/app.log'), 'controller.client');
var logger = log4js.getLogger('controller.client');
logger.setLevel('DEBUG');
logger.debug(‘hello, world’);



 [2010-09-28 19:50:24.816] [DEBUG] controller.user - hello, world
NOT ANOTHER NODE.JS
           HELLO WORLD
• An   application built to run on node.js

• Concepts

• Modules   used for the application

• Modules   extracted from the application

• How    dependencies of modules was managed

• Design   decisions made during development

• Hosting
EXTRACTED MODULES
• node-daemon   - a module for start-stop functionality without
 the need for init.d scripts (http://github.com/theteam/node-
 daemon)

• node-properties - a module for reading JSON property files
 using override pattern borrowed from Ant (http://github.com/
 theteam/node-properties)

• tapas-models
            - a module for common data entities with
 mongodb wrappers - (http://github.com/theteam/tapas-
 models)
NOT ANOTHER NODE.JS
           HELLO WORLD
• An   application built to run on node.js

• Concepts

• Modules   used for the application

• Modules   extracted from the application

• How    dependencies of modules was managed

• Design   decisions made during development

• Hosting
NDISTRO

• Bash  script that creates distributions from github for node
  binaries and modules

• Because   it’s bash, it can easily be extended

• Hash   simple syntax

• If
   modules are configured nicely, will symlink modules onto
  node execution path
NDISTRO EXAMPLE
node 0.2.0
module senchalabs connect
module visionmedia express 1.0.0beta2
module visionmedia ejs

                       ./bin/node
                       ./modules/senchalabs/connect
                       ./modules/visionmedia/express
                       ./modules/visionmedia/ejs
                       ./lib/node/connect
                       ./lib/node/express
                       ./lib/node/ejs
NOT ANOTHER NODE.JS
           HELLO WORLD
• An   application built to run on node.js

• Concepts

• Modules   used for the application

• Modules   extracted from the application

• How    dependencies of modules was managed

• Design   decisions made during development

• Hosting
DESIGN DECISIONS


• Included   everything from:

  • directory   structure

  • bootstrap   and running the application
NOT ANOTHER NODE.JS
           HELLO WORLD
• An   application built to run on node.js

• Concepts

• Modules   used for the application

• Modules   extracted from the application

• How    dependencies of modules was managed

• Design   decisions made during development

• Hosting
HOSTING



• Joyent   (https://no.de/)

• Heroku    (http://heroku.com/)

Más contenido relacionado

La actualidad más candente

Drupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developersDrupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developersnuppla
 
System webpack-jspm
System webpack-jspmSystem webpack-jspm
System webpack-jspmJesse Warden
 
Getting started with the Lupus Nuxt.js Drupal Stack
Getting started with the Lupus Nuxt.js Drupal StackGetting started with the Lupus Nuxt.js Drupal Stack
Getting started with the Lupus Nuxt.js Drupal Stacknuppla
 
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stacknuppla
 
JBoss Wise: breaking barriers to WS testing
JBoss Wise: breaking barriers to WS testingJBoss Wise: breaking barriers to WS testing
JBoss Wise: breaking barriers to WS testingalepalin
 
Xitrum HOWTOs
Xitrum HOWTOsXitrum HOWTOs
Xitrum HOWTOsNgoc Dao
 
Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)brendankowitz
 
Moving From Plexus To Guice
Moving From Plexus To GuiceMoving From Plexus To Guice
Moving From Plexus To GuiceStuart McCulloch
 
Develop plugin for Mozilla Firefox and structure a JS-based application
Develop plugin for Mozilla Firefox and structure a JS-based applicationDevelop plugin for Mozilla Firefox and structure a JS-based application
Develop plugin for Mozilla Firefox and structure a JS-based applicationAfshin Mehrabani
 
Node.js introduction
Node.js introductionNode.js introduction
Node.js introductionPrasoon Kumar
 
Xitrum @ Scala Conference in Japan 2013
Xitrum @ Scala Conference in Japan 2013Xitrum @ Scala Conference in Japan 2013
Xitrum @ Scala Conference in Japan 2013Ngoc Dao
 
Pre rendering media sites with nuxt.js & netlify
Pre rendering media sites with nuxt.js & netlifyPre rendering media sites with nuxt.js & netlify
Pre rendering media sites with nuxt.js & netlifynuppla
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJSHüseyin BABAL
 
Angular2 getting started by Stephen Lautier
Angular2 getting started by Stephen LautierAngular2 getting started by Stephen Lautier
Angular2 getting started by Stephen LautierAndrei Toma
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ... Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...Mikko Ohtamaa
 
Drupal 8 Vocab Lesson
Drupal 8 Vocab LessonDrupal 8 Vocab Lesson
Drupal 8 Vocab LessonMediacurrent
 

La actualidad más candente (20)

Drupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developersDrupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developers
 
System webpack-jspm
System webpack-jspmSystem webpack-jspm
System webpack-jspm
 
Getting started with the Lupus Nuxt.js Drupal Stack
Getting started with the Lupus Nuxt.js Drupal StackGetting started with the Lupus Nuxt.js Drupal Stack
Getting started with the Lupus Nuxt.js Drupal Stack
 
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
 
JBoss Wise: breaking barriers to WS testing
JBoss Wise: breaking barriers to WS testingJBoss Wise: breaking barriers to WS testing
JBoss Wise: breaking barriers to WS testing
 
Vue js for beginner
Vue js for beginner Vue js for beginner
Vue js for beginner
 
Xitrum HOWTOs
Xitrum HOWTOsXitrum HOWTOs
Xitrum HOWTOs
 
Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)
 
Moving From Plexus To Guice
Moving From Plexus To GuiceMoving From Plexus To Guice
Moving From Plexus To Guice
 
Develop plugin for Mozilla Firefox and structure a JS-based application
Develop plugin for Mozilla Firefox and structure a JS-based applicationDevelop plugin for Mozilla Firefox and structure a JS-based application
Develop plugin for Mozilla Firefox and structure a JS-based application
 
Getting started with angular js
Getting started with angular jsGetting started with angular js
Getting started with angular js
 
Node.js introduction
Node.js introductionNode.js introduction
Node.js introduction
 
AS7
AS7AS7
AS7
 
Xitrum @ Scala Conference in Japan 2013
Xitrum @ Scala Conference in Japan 2013Xitrum @ Scala Conference in Japan 2013
Xitrum @ Scala Conference in Japan 2013
 
Pre rendering media sites with nuxt.js & netlify
Pre rendering media sites with nuxt.js & netlifyPre rendering media sites with nuxt.js & netlify
Pre rendering media sites with nuxt.js & netlify
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJS
 
Angular2 getting started by Stephen Lautier
Angular2 getting started by Stephen LautierAngular2 getting started by Stephen Lautier
Angular2 getting started by Stephen Lautier
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ... Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 
An Overview on Nuxt.js
An Overview on Nuxt.jsAn Overview on Nuxt.js
An Overview on Nuxt.js
 
Drupal 8 Vocab Lesson
Drupal 8 Vocab LessonDrupal 8 Vocab Lesson
Drupal 8 Vocab Lesson
 

Similar a A nodejs application

Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting startedTriet Ho
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS偉格 高
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done RightMariusz Nowak
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureColin Mackay
 
uRequire@greecejs: An introduction to http://uRequire.org
uRequire@greecejs: An introduction to http://uRequire.orguRequire@greecejs: An introduction to http://uRequire.org
uRequire@greecejs: An introduction to http://uRequire.orgAgelos Pikoulas
 
Mongo and node mongo dc 2011
Mongo and node mongo dc 2011Mongo and node mongo dc 2011
Mongo and node mongo dc 2011async_io
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSGunnar Hillert
 
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.jsasync_io
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 
Irfan maulana nodejs web development
Irfan maulana   nodejs web developmentIrfan maulana   nodejs web development
Irfan maulana nodejs web developmentPHP Indonesia
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
Introduction to Node (15th May 2017)
Introduction to Node (15th May 2017)Introduction to Node (15th May 2017)
Introduction to Node (15th May 2017)Lucas Jellema
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jibanJibanananda Sana
 
Ember App Kit & The Ember Resolver
Ember App Kit & The Ember ResolverEmber App Kit & The Ember Resolver
Ember App Kit & The Ember Resolvertboyt
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.jsChris Cowan
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureTroy Miles
 
Let's run JavaScript Everywhere
Let's run JavaScript EverywhereLet's run JavaScript Everywhere
Let's run JavaScript EverywhereTom Croucher
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
Top 10 frameworks of node js
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node jsHabilelabs
 

Similar a A nodejs application (20)

Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting started
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
uRequire@greecejs: An introduction to http://uRequire.org
uRequire@greecejs: An introduction to http://uRequire.orguRequire@greecejs: An introduction to http://uRequire.org
uRequire@greecejs: An introduction to http://uRequire.org
 
Mongo and node mongo dc 2011
Mongo and node mongo dc 2011Mongo and node mongo dc 2011
Mongo and node mongo dc 2011
 
Node on Windows Azure
Node on Windows AzureNode on Windows Azure
Node on Windows Azure
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
 
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
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Irfan maulana nodejs web development
Irfan maulana   nodejs web developmentIrfan maulana   nodejs web development
Irfan maulana nodejs web development
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Introduction to Node (15th May 2017)
Introduction to Node (15th May 2017)Introduction to Node (15th May 2017)
Introduction to Node (15th May 2017)
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Ember App Kit & The Ember Resolver
Ember App Kit & The Ember ResolverEmber App Kit & The Ember Resolver
Ember App Kit & The Ember Resolver
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows Azure
 
Let's run JavaScript Everywhere
Let's run JavaScript EverywhereLet's run JavaScript Everywhere
Let's run JavaScript Everywhere
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
Top 10 frameworks of node js
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node js
 

Más de Robbie Clutton

Api - Hacks and Hackers
Api - Hacks and HackersApi - Hacks and Hackers
Api - Hacks and HackersRobbie Clutton
 
iPhone development or how to use the web for pretty much anything
iPhone development or how to use the web for pretty much anythingiPhone development or how to use the web for pretty much anything
iPhone development or how to use the web for pretty much anythingRobbie Clutton
 
Pushing The Boundaries Of Continuous Integration
Pushing The Boundaries Of Continuous IntegrationPushing The Boundaries Of Continuous Integration
Pushing The Boundaries Of Continuous IntegrationRobbie Clutton
 

Más de Robbie Clutton (7)

Api - Hacks and Hackers
Api - Hacks and HackersApi - Hacks and Hackers
Api - Hacks and Hackers
 
Options in scala
Options in scalaOptions in scala
Options in scala
 
Cache me if you can
Cache me if you canCache me if you can
Cache me if you can
 
iPhone development or how to use the web for pretty much anything
iPhone development or how to use the web for pretty much anythingiPhone development or how to use the web for pretty much anything
iPhone development or how to use the web for pretty much anything
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Pushing The Boundaries Of Continuous Integration
Pushing The Boundaries Of Continuous IntegrationPushing The Boundaries Of Continuous Integration
Pushing The Boundaries Of Continuous Integration
 
Cityuni
CityuniCityuni
Cityuni
 

Último

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Último (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

A nodejs application

  • 1. A NODE.JS APPLICATION Robbie Clutton
  • 2. NOT ANOTHER NODE.JS HELLO WORLD • An application built to run on node.js • Concepts • Modules used for the application • Modules extracted from the application • How dependencies of modules was managed • Design decisions made during development • Hosting
  • 3. NOT ANOTHER NODE.JS HELLO WORLD • An application built to run on node.js • Concepts • Modules used for the application • Modules extracted from the application • How dependencies of modules was managed • Design decisions made during development • Hosting
  • 4. CONCEPTS • CommonJS (http://www.commonjs.org) • Lint (http://www.javascriptlint.com/)
  • 5. NOT ANOTHER NODE.JS HELLO WORLD • An application built to run on node.js • Concepts • Modules used for the application • Modules extracted from the application • How dependencies of modules was managed • Design decisions made during development • Hosting
  • 6. TOOLBOX • nodejs - server side javascript vm (http://nodejs.org/) • connect - middleware (http://github.com/senchalabs/connect) • express - sinatra like routing (http://expressjs.com/) • ndistro - dependencies (http://github.com/visionmedia/ndistro) • ejs - view templates (http://github.com/visionmedia/ejs) • mongoose- mongodb driver(http://github.com/LearnBoost/ mongoose) • log4js - logging (http://github.com/csausdev/log4js-node)
  • 7. CONNECT • Middleware framework • Allowsfilters to be added to HTTP processing (e.g. logging, authentication)
  • 8. CONNECT EXAMPLE var server = Connect.createServer( Connect.logger(), function(req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World'); } );
  • 9. EXPRESS JS var app = require('express').createServer(); app.get('/', function(req, res){ res.send('hello world'); }); app.listen(3000);
  • 10. EJS res.render('show_username.ejs', { locals:{user:user} }); <% if (user) { %> <h2><%= user.name %></h2> <% } %>
  • 11. MONGOOSE var mongoose = require('../modules/mongoose/mongoose').Mongoose; var db = mongoose.connect('mongodb://localhost/tapas'); mongoose.model('User', { 'properties': ['username', 'password', 'first', 'last', ...], 'indexes': ['first', 'last', [{'username':1},{unique: true}]], 'methods': { save: function(fn){ this.updated_at = new Date(); this.__super__(fn); } } }); module.exports = db.model('User');
  • 12. LOG4JS var log4js = require('log4js'); log4js.addAppender(log4js.fileAppender('log/app.log'), 'controller.client'); var logger = log4js.getLogger('controller.client'); logger.setLevel('DEBUG'); logger.debug(‘hello, world’); [2010-09-28 19:50:24.816] [DEBUG] controller.user - hello, world
  • 13. NOT ANOTHER NODE.JS HELLO WORLD • An application built to run on node.js • Concepts • Modules used for the application • Modules extracted from the application • How dependencies of modules was managed • Design decisions made during development • Hosting
  • 14. EXTRACTED MODULES • node-daemon - a module for start-stop functionality without the need for init.d scripts (http://github.com/theteam/node- daemon) • node-properties - a module for reading JSON property files using override pattern borrowed from Ant (http://github.com/ theteam/node-properties) • tapas-models - a module for common data entities with mongodb wrappers - (http://github.com/theteam/tapas- models)
  • 15. NOT ANOTHER NODE.JS HELLO WORLD • An application built to run on node.js • Concepts • Modules used for the application • Modules extracted from the application • How dependencies of modules was managed • Design decisions made during development • Hosting
  • 16. NDISTRO • Bash script that creates distributions from github for node binaries and modules • Because it’s bash, it can easily be extended • Hash simple syntax • If modules are configured nicely, will symlink modules onto node execution path
  • 17. NDISTRO EXAMPLE node 0.2.0 module senchalabs connect module visionmedia express 1.0.0beta2 module visionmedia ejs ./bin/node ./modules/senchalabs/connect ./modules/visionmedia/express ./modules/visionmedia/ejs ./lib/node/connect ./lib/node/express ./lib/node/ejs
  • 18. NOT ANOTHER NODE.JS HELLO WORLD • An application built to run on node.js • Concepts • Modules used for the application • Modules extracted from the application • How dependencies of modules was managed • Design decisions made during development • Hosting
  • 19. DESIGN DECISIONS • Included everything from: • directory structure • bootstrap and running the application
  • 20. NOT ANOTHER NODE.JS HELLO WORLD • An application built to run on node.js • Concepts • Modules used for the application • Modules extracted from the application • How dependencies of modules was managed • Design decisions made during development • Hosting
  • 21. HOSTING • Joyent (https://no.de/) • Heroku (http://heroku.com/)

Notas del editor