21 lines
409 B
TypeScript
21 lines
409 B
TypeScript
import { configs } from './config.ts'
|
|
import Fastify from 'fastify'
|
|
|
|
const fastify = Fastify({
|
|
logger: true
|
|
})
|
|
|
|
|
|
// Declare a route
|
|
fastify.get('/', function (request, reply) {
|
|
reply.send({ hello: 'world' })
|
|
})
|
|
|
|
// Run the server!
|
|
fastify.listen({ port: configs.port }, function (err, address) {
|
|
if (err) {
|
|
fastify.log.error(err)
|
|
process.exit(1)
|
|
}
|
|
// Server is now listening on ${address}
|
|
}) |