SlideShare uma empresa Scribd logo
1 de 21
Baixar para ler offline
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/)

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante 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
 
Irfan maulana nodejs web development
Irfan maulana   nodejs web developmentIrfan maulana   nodejs web development
Irfan maulana nodejs web developmentPHP Indonesia
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 
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
 

Semelhante 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
 
Irfan maulana nodejs web development
Irfan maulana   nodejs web developmentIrfan maulana   nodejs web development
Irfan maulana nodejs web development
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - 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
 

Mais 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
 

Mais 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

Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdfPaige Cruz
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Alexander Turgeon
 
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideIEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideHironori Washizaki
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5DianaGray10
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 

Último (20)

Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideIEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 

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 do Editor