Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Newbie on Node
Search
Edvinas
February 19, 2014
Programming
200
0
Share
Newbie on Node
My experience starting to build side project with Node. Presented in Vilnius.JS meetup.
Edvinas
February 19, 2014
More Decks by Edvinas
See All by Edvinas
Peak of a Programmer
edvinasbartkus
1
110
Other Decks in Programming
See All in Programming
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
210
アクセシビリティ試験の"その後"を仕組み化する
yuuumiravy
1
180
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
120
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
470
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
4
460
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.3k
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
110
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
320
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
330
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
510
Vibe NLP for Applied NLP
inesmontani
PRO
0
550
[RubyKaigi 2026] Require Hooks
palkan
1
270
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
780
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
130
Crafting Experiences
bethany
1
130
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.9k
The untapped power of vector embeddings
frankvandijk
2
1.7k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
180
The Mindset for Success: Future Career Progression
greggifford
PRO
0
320
How to build a perfect <img>
jonoalderson
1
5.4k
Claude Code のすすめ
schroneko
67
220k
For a Future-Friendly Web
brad_frost
183
10k
Transcript
node.js newbie
Chapter #0
Chapter #0 What I want to say?
None
None
Chapter #1
About newbie
Find me github.com/edvinasbartkus
None
None
None
Chapter #2
Chapter #2
⚡ which node /usr/local/bin/node
⚡ which node /usr/local/bin/node
⚡ npm install something ⚡ ls -l drwxr-xr-x node_modules/
⚡ npm install -g something
⚡ cat package.json { "name": "commentreader", "version": "0.0.1", "main": "app.js",
"scripts": { "test": "./node_modules/.bin/mocha --recursive -R xunit test/ > test-reports.xml", "migrate": "./node_modules/.bin/db-migrate up" }, "dependencies": { "express": "3.4.8", "knex": "~0.5.4", "bookshelf": "~0.6.2", "pg": "~2.11.1", "socket.io": "~0.9.16", "htmlparser2": "~3.4.0", "minreq": "~0.2.3", "request": "~2.33.0" }, "devDependencies": { "grunt": "~0.4.2", "grunt-express-server": "~0.4.11", "grunt-contrib-watch": "~0.5.3", "grunt-contrib-concat": "~0.3.0", "should": "~3.1.0", "supertest": "~0.9.0", "mocha": "~1.17.1", "db-migrate": "~0.6.3" } }
CODE STRUCTURE Gruntfile.js Procfile README.md app/ - domains/ - models/
- routes/ - views/ app.js browser/ - components/ - controllers/ - views/ - main.js config.js database.json migrations/ node_modules/ package.json public/ test/ worker.js
// Express var app = express(); app.configure(function () { app.use(express.logger('dev'));
app.use(express.bodyParser()); ! var viewsDir = path.join(__dirname + ‘/browser/views'); app.use(‘/views', express.static(viewsDir)); ! var publicDir = path.join(__dirname + ‘/public'); app.use(express.static(publicDir)); }); EXPRESS
// Routes var pages = require('./app/routes/pages'); app.get('/pages', pages.findAll); app.get('/pages/:id', pages.findById);
app.post('/pages', pages.addPage); EXPRESS ROUTES
// Server var server = app.listen(config.port); ! // Sockets var
sockets = require('./app/sockets')(server); RUN & ATTACH SOCKETS
'use strict'; ! var socket = require('socket.io'); ! module.exports =
function (app) { var io = socket.listen(app, { log: false }); io.on('connection', function (socket) { console.log('User connected'); }); ! // socket.join('room:test'); return io; }; SOCKETS.IO
Chapter #3
Chapter #3
T H E W E B ' S S C
A F F O L D I N G T O O L F O R M O D E R N W E B A P P S
None
Chapter #3.1
Chapter #3.1
GRUNT
Chapter #4
Chapter #4
None
'use strict'; ! var should = require('should'); var app =
require('./../app.js'); ! describe('Existance', function () { it('should exist', function (done) { should.exist(app); done(); }); });
! var should = require('should'); var request = require('supertest'); var
app = require('./../app.js'); ! describe('Pages API', function () { it('GET /pages 200', function (done) { request(app) .get('/pages') .expect(200, done); });
⚡ mocha test/ ! ․․․ ! 3 passing (85ms)
BUSTER.JS INTERN.JS
None
None
Have you met Jenkins?
None
⚡ cat package.json { "main": "app.js", "scripts": { "test": “./node_modules/.bin/mocha
--recursive -R xunit test/ > test-reports.xml”, ! "migrate": "./node_modules/.bin/db-migrate up" }, "dependencies": { }, "devDependencies": { } }
Chapter #Lost_Nmbr.2
None
Free 1 dyno ! !
Free 1 dyno 512mb ram !
Free 1 dyno 512mb ram 4 (virtual) CPU cores Intel
Xeon X5550 @ 2.67GHz
Free 1 dyno 750 free hours !
⚡ cat Procfile web: node app.js
⚡ cat Procfile web: node app.js worker: node worker.js
Heroku idles
Heroku idles Do you remember Jenkins?
Heroku idles Pingdom is also cool
Deploy in 6 seconds
Do not use console.log http://micheljansen.org/blog/entry/1698
Redis & RabbitMQ & Postgres
None
What is the right path?
None
None
Chat Chapter irc.freenode.org #VilniusJS