You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
overseerr/server/index.ts

32 lines
724 B

import express from 'express';
import next from 'next';
import { createConnection } from 'typeorm';
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();
createConnection();
app
.prepare()
.then(() => {
const server = express();
server.get('/api', (req, res) => {
res.json({ worked: true });
});
server.get('*', (req, res) => handle(req, res));
const port = Number(process.env.PORT) || 3000;
server.listen(port, (err) => {
if (err) {
throw err;
}
console.log(`Ready to do stuff http://localhost:${port}`);
});
})
.catch((err) => {
console.error(err.stack);
process.exit(1);
});