forked from joedevgee/node-fast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (33 loc) · 827 Bytes
/
index.js
File metadata and controls
39 lines (33 loc) · 827 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const fastify = require("fastify")({
logger: true
});
const storeRoute = require("./src/api/store/store.route");
const productRoute = require("./src/api/product/product.route");
// Register for OPEN API spec
fastify.register(require("fastify-swagger"), {
swagger: {
info: {
title: "Test swagger",
description: "testing the fastify swagger api",
version: "0.1.0"
}
},
exposeRoute: true,
routePrefix: "/documentation"
});
// Register for routes
fastify.register(storeRoute, {
prefix: "/store"
});
fastify.register(productRoute, {
prefix: "/product"
});
fastify.ready(err => {
if (err) throw err;
fastify.log.info("Starting Swagger docs");
fastify.swagger();
});
fastify.listen(3000, (err, add) => {
if (err) throw err;
fastify.log.info(`Listening on address: ${add}`);
});