SlideShare a Scribd company logo
Building
Websites using
Node.ACS
Ricardo Alcocer
Lead Developer Evangelist @ Appcelerator
About me
1. Have been using Titanium since late 2009
2. Former Titanium trainer in the Caribbean and Latin America
3. Currently work as Lead Developer Evangelist
4. Obsessed with cross-platform mobile develoment
5. Love Javascript hacking and technology startups
6. I'm a hacker in constant training
What is Node.ACS
1. Develop and publish node.js apps to the cloud
2. Simple CLI interface and built-in webserver
3. Built-in ACS support
4. Integrated with Titanium Studio
5. It's Javascript but for the server!
Install Node.ACS
Node.ACS runs on top of node.js
Studio installs Node and NPM by default
If you don't, install it from http://nodejs.org/
Run node -v to make sure you have it and then install ACS
node -v
sudo npm install -g acs
Login to Node.ACS
acs login
Create a new Node.ACS
acs new -my_app_name-
Starting your first Node.ACS
acs run
Viewing on the browser
Publishing first app
acs publish
acs publish --force
First app published
MVC Framework
Config.json
{
"routes":
[
{ "path": "/", "callback": "application#index" }
],
"filters":
[
{ "path": "/", "callback": "" }
],
"websockets":
[
{ "event": "", "callback": ""}
]
}
Callbacks are in filename#functionname format
Default HTTP Method is GET. For post we need to add
"method":"post"
Web Sockets are a whole different talk. More info at
http://socket.io/
A simple Web Site
A simple Web Site
(config.json)
{
"routes":
[
{ "path": "/", "callback": "application#index" },
{ "path": "/home", "callback": "application#home" },
{ "path": "/login", "method":"post", "callback": "application#login" },
{ "path": "/logoff", "callback": "application#logoff" }
],
"filters":
[
{ "path": "/home", "callback": "session_filter#validateSession" }
],
"websockets":
[
{ "event": "", "callback": ""}
]
}
Configure your app to track
sessions
(app.js)
// initialize app
function start(app, express) {
//set favicon
app.use(express.favicon(__dirname + '/public/images/favicon.ico'));
//instantiate session management
app.use(express.session({secret: '1234567890QWERTY'}));
}
// release resources
function stop() {
}
There's more to sessions. See http://expressjs.com
A simple Web Site
(application.js)
function index(req, res) {
res.render('index', { title: 'Welcome to Node.ACS!' });
}
function login(req, res) {
var uid=req.body.uid;
var pwd=req.body.pwd;
var name=req.body.name;
if (uid==='appc' && pwd=='nodeacs'){
req.session.uid=uid;
req.session.pwd=pwd;
req.session.name=name;
res.redirect('/home');
}else{
res.send(500, { error: 'something blew up' });
}
}
function logoff(req, res) {
req.session.uid=null;
req.session.pwd=null;
req.session.name=null;
res.redirect('/');
}
function home(req, res) {
res.render('home', { title: req.session.name });
}
The Index View
(index.ejs)
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<link rel='stylesheet' href='/css/style.css' />
</head>
<body>
<h2>Node.ACS</h2>
<form action="/login" method="post">
<div>Name<input type="text" name="name"/></div>
<div>UID<input type="text" name="uid"/></div>
<div>PWD<input type="password" name="pwd"/></div>
<div><input type="submit" value="Go"></div>
</form>
</body>
</html>
The Home View
(home.ejs)
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/css/style.css' />
</head>
<body>
<h2>Node.ACS</h2>
<p>Welcome Home, <%= title %>!</p>
<div><a href="/logoff">Log off</a></div>
</body>
</html>
Validating sessions
(session_filter.js)
function validateSession(req, res, next) {
if(req.session.uid === null) {
res.redirect('/');
} else {
next();
}
}
Walk-thru : ACS front-end
https://github.com/ricardoalcocer/nodeacs_sample_website
Walk-thru : SaveJSON
https://github.com/ricardoalcocer/acs_key_value_store
Creating a "catch-all" route
app.get('/get/*',function(req,res){
urlParam=req.path.replace(//$/, "").split('/').pop();
// do what you want with your url parameter
});
Some useful tools
http://www.jsontest.com/
http://www.jsoneditoronline.org/
http://posttestserver.com/
http://code.google.com/p/cocoa-rest-client/
Thank you!
Questions?
Follow me on
Twitter: @ricardoalcocer
Github: /ricardoalcocer

More Related Content

What's hot (20)

PDF
Coding for entrepreneurs
Amine Sadry
 
PDF
Intro to the Express Web Framework
jasonsich
 
PDF
Vagrant for real (codemotion rome 2016)
Michele Orselli
 
PPTX
Best Practices for creating WP REST API by Galkin Nikita
WordCamp Kyiv
 
PDF
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Ryan Weaver
 
PDF
Write php deploy everywhere tek11
Michelangelo van Dam
 
PPT
Vagrant
Nathan Howard
 
PDF
#Continuous delivery with #Deployit
Xebia IT Architects
 
PDF
[1C1]Service Workers
NAVER D2
 
PPTX
Express JS
Designveloper
 
PDF
Service workers
jungkees
 
PDF
Local development with vvv jon trujillo
Jonathan Trujillo
 
PDF
Vagrant for real codemotion (moar tips! ;-))
Michele Orselli
 
PPTX
So I Wrote a Manifest
Puppet
 
PDF
快快樂樂用Homestead
Chen Cheng-Wei
 
DOCX
Terraform bootstrap code_execute
rknaik76
 
PDF
Openstack Vagrant plugin overview
Marton Kiss
 
PPTX
Build RESTful API Using Express JS
Cakra Danu Sedayu
 
PPTX
WordPress Security 101
Shady A. Sharaf
 
PPTX
Vagrant crash course
Marcus Deglos
 
Coding for entrepreneurs
Amine Sadry
 
Intro to the Express Web Framework
jasonsich
 
Vagrant for real (codemotion rome 2016)
Michele Orselli
 
Best Practices for creating WP REST API by Galkin Nikita
WordCamp Kyiv
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Ryan Weaver
 
Write php deploy everywhere tek11
Michelangelo van Dam
 
Vagrant
Nathan Howard
 
#Continuous delivery with #Deployit
Xebia IT Architects
 
[1C1]Service Workers
NAVER D2
 
Express JS
Designveloper
 
Service workers
jungkees
 
Local development with vvv jon trujillo
Jonathan Trujillo
 
Vagrant for real codemotion (moar tips! ;-))
Michele Orselli
 
So I Wrote a Manifest
Puppet
 
快快樂樂用Homestead
Chen Cheng-Wei
 
Terraform bootstrap code_execute
rknaik76
 
Openstack Vagrant plugin overview
Marton Kiss
 
Build RESTful API Using Express JS
Cakra Danu Sedayu
 
WordPress Security 101
Shady A. Sharaf
 
Vagrant crash course
Marcus Deglos
 

Similar to Building websites with Node.ACS (20)

PPTX
Intro To Node.js
Chris Cowan
 
PPTX
Reactive application using meteor
Sapna Upreti
 
PDF
Web APIs & Apps - Mozilla
Robert Nyman
 
PPTX
Angularjs Tutorial for Beginners
rajkamaltibacademy
 
PDF
Service Worker - Reliability bits
jungkees
 
PDF
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
PDF
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
PDF
Tutorial: Develop Mobile Applications with AngularJS
Philipp Burgmer
 
PDF
WebAPIs & Apps - Mozilla London
Robert Nyman
 
PDF
HTML5 tutorial: canvas, offfline & sockets
Remy Sharp
 
PPTX
Kraken
PayPal
 
PPT
nodejs tutorial foor free download from academia
rani marri
 
PDF
NodeJS @ ACS
Mauro Parra-Miranda
 
PDF
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Codemotion
 
PDF
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
Fwdays
 
PDF
Day in a life of a node.js developer
Edureka!
 
PDF
Day In A Life Of A Node.js Developer
Edureka!
 
PDF
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
PDF
Always on! Or not?
Carsten Sandtner
 
PDF
Always on! ... or not?
Carsten Sandtner
 
Intro To Node.js
Chris Cowan
 
Reactive application using meteor
Sapna Upreti
 
Web APIs & Apps - Mozilla
Robert Nyman
 
Angularjs Tutorial for Beginners
rajkamaltibacademy
 
Service Worker - Reliability bits
jungkees
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
Tutorial: Develop Mobile Applications with AngularJS
Philipp Burgmer
 
WebAPIs & Apps - Mozilla London
Robert Nyman
 
HTML5 tutorial: canvas, offfline & sockets
Remy Sharp
 
Kraken
PayPal
 
nodejs tutorial foor free download from academia
rani marri
 
NodeJS @ ACS
Mauro Parra-Miranda
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Codemotion
 
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
Fwdays
 
Day in a life of a node.js developer
Edureka!
 
Day In A Life Of A Node.js Developer
Edureka!
 
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
Always on! Or not?
Carsten Sandtner
 
Always on! ... or not?
Carsten Sandtner
 
Ad

More from ralcocer (15)

PDF
Multi platform development using titanium + alloy
ralcocer
 
PDF
Develop your first mobile App for iOS and Android
ralcocer
 
PPTX
Slides for tiTokyo 2013 - Japanese version
ralcocer
 
PPTX
Appcelerator Alloy Deep Dive - tiTokyo 2013
ralcocer
 
PDF
Learning Appcelerator® Alloy™
ralcocer
 
PDF
De Wordpress.com a Wordpress.org
ralcocer
 
PDF
Barcamp Mayaguez 2012
ralcocer
 
PDF
Cómo crear plugins para Wordpress
ralcocer
 
PDF
Open Source, estándares y arquitecturas Web 2.0
ralcocer
 
PDF
El pensamiento crítico y el uso de tecnología
ralcocer
 
PDF
El OpenSource en la educación
ralcocer
 
PDF
El valor educativo del Open Source
ralcocer
 
PDF
Presentación APH
ralcocer
 
PDF
Educapr Oct2010
ralcocer
 
PPT
The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010
ralcocer
 
Multi platform development using titanium + alloy
ralcocer
 
Develop your first mobile App for iOS and Android
ralcocer
 
Slides for tiTokyo 2013 - Japanese version
ralcocer
 
Appcelerator Alloy Deep Dive - tiTokyo 2013
ralcocer
 
Learning Appcelerator® Alloy™
ralcocer
 
De Wordpress.com a Wordpress.org
ralcocer
 
Barcamp Mayaguez 2012
ralcocer
 
Cómo crear plugins para Wordpress
ralcocer
 
Open Source, estándares y arquitecturas Web 2.0
ralcocer
 
El pensamiento crítico y el uso de tecnología
ralcocer
 
El OpenSource en la educación
ralcocer
 
El valor educativo del Open Source
ralcocer
 
Presentación APH
ralcocer
 
Educapr Oct2010
ralcocer
 
The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010
ralcocer
 
Ad

Recently uploaded (20)

PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Complete Network Protection with Real-Time Security
L4RGINDIA
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
July Patch Tuesday
Ivanti
 
Complete Network Protection with Real-Time Security
L4RGINDIA
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 

Building websites with Node.ACS