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
Comparison nodejs frameworks using Polls API
Search
Ladislav Prskavec
May 23, 2015
Technology
0
75
Comparison nodejs frameworks using Polls API
3 NodeJS implementations of Polls API.
All implementations are tested by Dredd.
Ladislav Prskavec
May 23, 2015
Tweet
Share
More Decks by Ladislav Prskavec
See All by Ladislav Prskavec
Build nice terminal UI with Bubble Tea
abtris
1
160
How to make own observability solution?
abtris
0
180
OpenTelemetry as best way how to instrument your CICD pipeline
abtris
0
210
Prague Go Meetup #12 Introductions
abtris
0
31
How we run stateful services for customers in Kubernetes
abtris
0
290
Go Release 1.20
abtris
0
160
CI pipelines should be code! Dagger Go SDK
abtris
1
300
Getting started with fuzzing
abtris
0
290
Jamstack in 2021
abtris
0
74
Other Decks in Technology
See All in Technology
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership, regardless of position
madoxten
13
7.9k
エンジニア主導の企画立案を可能にする組織とは?
recruitengineers
PRO
1
310
エンジニアの健康管理術 / Engineer Health Management Techniques
y_sone
4
730
開発者体験を定量的に把握する手法と活用事例
ham0215
0
140
データベースの負荷を紐解く/untangle-the-database-load
emiki
2
550
プロダクト開発者目線での Entra ID 活用
sansantech
PRO
0
140
Introduction to OpenSearch Project - Search Engineering Tech Talk 2025 Winter
tkykenmt
2
220
RayでPHPのデバッグをちょっと快適にする
muno92
PRO
0
200
[OpsJAWS Meetup33 AIOps] Amazon Bedrockガードレールで守る安全なAI運用
akiratameto
1
140
20250304_赤煉瓦倉庫_DeepSeek_Deep_Dive
hiouchiy
2
130
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
19k
リクルートのエンジニア組織を下支えする 新卒の育成の仕組み
recruitengineers
PRO
2
180
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Practical Orchestrator
shlominoach
186
10k
Music & Morning Musume
bryan
46
6.4k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
440
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
GraphQLの誤解/rethinking-graphql
sonatard
69
10k
Site-Speed That Sticks
csswizardry
4
420
The Cult of Friendly URLs
andyhume
78
6.2k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Mobile First: as difficult as doing things right
swwweet
223
9.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
Transcript
Comparison NodeJS frameworks ladislav@prskavec.net @abtris www.praguejs.cz @jsconfcz
None
express koa hapi github stars 18861 6174 4228 contributors 178
59 116 downloads / w 525941 8769 11966 stack overflow 14853 138 66 npm -ls | wc -l 48 36 48 file size 3896 2000 50392
http://docs.nodeschoolhk.apiary.io/
https://github.com/apiaryio/dredd
Init server
"express": "^4.12.3" (function() { 'use strict'; var express = require('express');
var app = express(); app.set('json spaces', 2); .... var server = app.listen(3003, function() { var host = server.address().address; var port = server.address().port; console.log('Example app listening at http://%s:%s', host, port); }); }());
"hapi": "^8.4.0" var Hapi = require('hapi'); var server = new
Hapi.Server(); server.connection({port: 3001}); .... // Start the server server.start(function() { console.log('Server running at:', server.info.uri); });
"koa": "^0.20.0" "use strict"; var koa = require('koa'); var route
= require('koa-route'); var app = koa(); require('koa-qs')(app); .... app.listen(3000);
Routing
"express": "^4.12.3" app.get('/questions/:question_id', function(req, res) { res.status(200).json({"question":"Favourite programming language?"...}]}); });
app.post('/questions/:question_id/choices/:choice_id', function(req, res) { res.set('Location', '/questions/' + req.params.question_id); res.status(201).send(''); });
"hapi": "^8.4.0" server.route({ method: 'GET', path: '/questions/{question_id}', handler: function(request, reply)
{ reply({"question":"Favourite programming language?"...}); } }); server.route({ method: 'POST', path: '/questions/{question_id}/choices/{choice_id}', handler: function(request, reply) { reply().code(201).header('Location', '/questions/' + request.params.question_id); } });
"koa": "^0.20.0" app.use(route.get('/questions/:question_id', function *(question_id) { this.body = {"question":"Favourite programming
language?"...}; })); app.use(route.post('/questions/:question_id/choices/:choice_id', function *(question_id, choice_id) { this.status = 201; this.set('Location', '/questions/' + question_id); this.body = ''; }));
Testing • Dredd var hooks = require('hooks'); var before =
hooks.before; hooks.beforeEach(function(transaction) { if (transaction.expected.headers['Content-Type'] == 'application/json') { transaction.expected.headers['Content-Type'] = 'application/json; charset=utf-8'; } });
Github repository of project: https://github.com/abtris/nodeschool-hk-2015-05-23 Ideas how project improve: •
you can fork and contribute • you can try add 404, 500 pages • you can try persistent layer using Redis