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.

25 lines
580 B

const fastify = require('fastify')({
logger: true
})
// adding files and plugins
fastify
.register(require('./http/web.js'))
.register(require('./api/state.js'), { 'prefix': '/api' })
.register(require('fastify-static'), {
root: path.join(__dirname, 'public'),
prefix: '/public/
})
// let it rain
const start = async () => {
try {
await fastify.listen(3000)
fastify.log.info(`server listening on ${fastify.server.address().port}`)
} catch (err) {
fastify.log.error(err)
process.exit(1)
}
}
start()