forked from PlainSight/NodeRestPerfTest3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfastifyserver.js
More file actions
24 lines (20 loc) · 741 Bytes
/
fastifyserver.js
File metadata and controls
24 lines (20 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict'
// last update 1 day ago!
// 24,3k stars
// has internal types definitions
// has deprecation warning on start!
/* (node:17376) [FSTDEP011] FastifyDeprecation: Variadic listen method is deprecated. Please use ".listen(optionsObject)" instead. The variadic signature will be removed in `fastify@5`.
(Use `node --trace-warnings ...` to show where the warning was created)
server listening on 8000
*/
const fastify = require('fastify');
const app = fastify();
app.get('/', (req, reply) => {
reply
.header('Connection', 'close')
.send('Hello world!');
});
app.listen(process.env.PORT || 8000, err => {
if (err) throw err;
console.log(`fastify server listening on ${ app.server.address().port }`);
});