Fix CORS and exit

This commit is contained in:
Djuri Baars 2022-01-18 15:02:35 +01:00
parent a72da0c7f8
commit c4c7288d39
2 changed files with 8 additions and 4 deletions

View file

@ -21,14 +21,16 @@ const build = (opts = {}) => {
.register(fastifyStatic, {
root: path.join(__dirname, '../public'),
})
.register(socketioServer)
.register(fastifyCors)
.register(socketioServer, {
cors: {
origin: true,
},
})
.register(fastifySensible)
.register(bootstrap, {
directory: resolve(__dirname, 'controllers'),
mask: /\.controller\./,
})
.register(fastifyCors, {
origin: '*',
});
return app;

View file

@ -18,3 +18,5 @@ server.listen(process.env.PORT || 7464, '::', (err, address) => {
process.exit(1);
}
});
process.on('SIGINT', () => process.exit(1));