@TODO write something about how freaking terrible situation is in koa ecosystemAgenda
"Hey, guys, let's try koa?"
Koa
Express
Overall
Overall
Contributions
What is Koa
Middleware
CoreRouting
Template
EngineHTTP
Utilities
Koa
+
-
-
-
Express
+
+
+
+
Connect
+
-
-
-
Why Koa? 💡
Event Loop
console.log(1);
setTimeout(() => console.log(2), 0);
console.log(3);
// 1
// 3
// 2
Async
const chownCallback = () => ...;
fs.chown(path, uid, gid, chownCallback);
Sync
fs.chownSync(path, uid, gid);
/** some logic after chown */
Async
Async
Async / Await
Async / Await
fetch('https://someapi.somedomain/something')
.then(response => response.json())
.then(json => console.log(json));
Async / Await
const res = await fetch('https://someapi.somedomain/something');
const json = await res.json();
console.log(json);
Middlewares
Middlewares
Middleware Architecture
Scaffold
const Koa = require('koa');
const app = new Koa();
app.use(async ctx => {
ctx.body = 'Hello Hannover!';
});
app.listen(3000);
Middleware
const Koa = require('koa');
const app = new Koa();
app.use(async (ctx, next) => {
const res = await nextElections();
ctx.body = res;
...
await next();
});
app.listen(3000);
Writing a middleware
(ctx, next) => {}
What to take care about
Libs Quality
Express?
Performance isn't about tools...
Performance: Databases
Performance: HTTP
Peformance: Queues
Queue
Queues
Performance: Caching
Caching
Error Handling
What do I use
Security
Handpicked
Questions?
Send me a Pigeon