forked from fastify/fastify-example-twitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (27 loc) · 818 Bytes
/
index.js
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
'use strict'
const path = require('path')
const swaggerOption = {
swagger: {
info: {
title: 'Test swagger',
description: 'testing the fastify swagger api',
version: '0.1.0'
},
host: 'localhost',
schemes: ['http'],
consumes: ['application/json'],
produces: ['application/json']
}
}
module.exports = async function (fastify, opts) {
fastify
.register(require('./user'), { prefix: '/api/user' })
.register(require('./tweet'), { prefix: '/api/tweet' })
.register(require('./follow'), { prefix: '/api/follow' })
.register(require('./timeline'), { prefix: '/api/timeline' })
.register(require('fastify-swagger'), swaggerOption)
.register(require('fastify-static'), {
root: path.join(__dirname, 'frontend', 'build'),
prefix: '/'
})
}