优化路由

This commit is contained in:
zyc404 2023-10-08 18:48:34 +08:00
parent 5d5535ed6e
commit d6fb62c424

View file

@ -50,6 +50,13 @@ async function routes(fastify, options) {
reply.type('text/html').send(stream)
return reply
})
fastify.setNotFoundHandler((request, reply) => {
if (request.method === 'GET') {
reply.sendFile('plugins/chatgpt-plugin/server/static/index.html')
} else {
reply.code(404).send(new Error('Not Found'))
}
})
}
export default routes