18 lines
323 B
TypeScript
18 lines
323 B
TypeScript
|
import autoload from '@fastify/autoload'
|
||
|
import Fastify from 'fastify'
|
||
|
import path from 'path'
|
||
|
|
||
|
const server = Fastify({
|
||
|
logger: true
|
||
|
})
|
||
|
|
||
|
server.register(autoload, {
|
||
|
dir: path.join(__dirname, 'routes')
|
||
|
})
|
||
|
|
||
|
try {
|
||
|
await server.listen({ port: 3000 })
|
||
|
} catch (err) {
|
||
|
server.log.error(err)
|
||
|
process.exit(1)
|
||
|
}
|