You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
782 B

3 years ago
import fastify from 'fastify'
import dotenv from 'dotenv'
import path from 'path'
// getting .env
dotenv.config({ path: path.join(path.resolve(), '/../../.env') })
// create server
const server = fastify()
/**
* add plugins
*
*/
3 years ago
import { Liquid } from 'liquidjs'
import pov from 'point-of-view'
3 years ago
3 years ago
const engine = new Liquid({
root: path.join(path.resolve(), '../frontend/views'),
extname: '.liquid',
})
3 years ago
3 years ago
server.register(pov, {
engine: {
liquid: engine
}
})
3 years ago
/**
* add routes
*
*/
3 years ago
import actionHttp from './http/api/action.js'
3 years ago
import indexHttp from './http/index.js'
import staticHttp from './http/static.js'
server
3 years ago
.register(actionHttp, {
3 years ago
'prefix': '/api'
})
.register(indexHttp)
.register(staticHttp)
export default server