Skip to content

Commit

Permalink
优化路由
Browse files Browse the repository at this point in the history
  • Loading branch information
HalcyonAlcedo committed Oct 8, 2023
1 parent 5d5535e commit d6fb62c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/modules/web_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d6fb62c

Please sign in to comment.