Tested in Windows 10 system with
deno 1.0.3
v8 8.4.300
typescript 3.9.2
Powered by Apache JMeter (v5.3) Each test performed with 10 threads during the 10 seconds
import { App } from "https://deno.land/x/attain/mod.ts";
const app = new App();
app.use((req, res) => {
res.status(200).send("Hello world!");
});
app.listen({ port: 3500 });
import { App, logger } from "https://deno.land/x/attain/mod.ts";
const app = new App();
app.use(logger);
app.use("/", (req, res) => {
res.status(200).send("Hello world!");
});
app.listen({ port: 3500 });
five simple middlewares with logger and router
import { App, Request, Response } from "https://deno.land/x/attain/mod.ts";
const app = new App();
const hello = (req: Request, res: Response) => {
console.log("hello")
};
app.use(logger);
app.use(hello, hello, hello, hello, hello);
app.use("/", (req, res) => {
res.status(200).send("Hello world!");
});
app.listen({ port: 3500 });
const express = require('express')
const app = express()
const port = 5000
app.get((req, res) => {
res.send('Hello World!')
})
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
const express = require('express')
const app = express()
const morgan = require('morgan')
const port = 5000
app.use(morgan('tiny'));
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
five simple middlewares with logger and router
const express = require('express')
const app = express()
const morgan = require('morgan')
const port = 5000
const hello = (req, res, next) => {
console.log("hello")
next();
}
app.use(morgan('tiny'));
app.use(hello, hello, hello, hello, hello)
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
import { Application } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
app.use((ctx) => {
ctx.response.body = "Hello World!";
});
await app.listen({ port: 8000 });
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
const router = new Router();
router
.get("/", (context) => {
context.response.body = "Hello world!";
})
app.use(async (ctx, next) => {
await next();
const rt = ctx.response.headers.get("X-Response-Time");
console.log(`${ctx.request.method} ${ctx.request.url} - ${rt}`);
});
app.use(router.routes());
app.use(router.allowedMethods());
await app.listen({ port: 8000 });
five simple middlewares with logger and router
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
const router = new Router();
const hello = (ctx: any, next: any) => {
console.log("hello1");
next()
}
router
.get("/", (context) => {
context.response.body = "Hello world!";
})
app.use(hello, hello, hello, hello, hello)
app.use(async (ctx, next) => {
await next();
const rt = ctx.response.headers.get("X-Response-Time");
console.log(`${ctx.request.method} ${ctx.request.url} - ${rt}`);
});
app.use(router.routes());
app.use(router.allowedMethods());
await app.listen({ port: 8000 });