mirror of
https://github.com/dotFionn/iassure-wx.git
synced 2026-03-21 06:22:56 -05:00
implementation
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import express, { NextFunction, Request, Response } from 'express';
|
||||
import nodesched from 'node-schedule';
|
||||
import morgan from 'morgan';
|
||||
import router from './router';
|
||||
import wxService from './services/wx.service';
|
||||
|
||||
const { PORT = 3000 } = process.env;
|
||||
|
||||
const app = express();
|
||||
|
||||
app.set('trust proxy', true);
|
||||
app.use(morgan('combined'));
|
||||
|
||||
app.use('/api', router.router);
|
||||
|
||||
const frontendRoot = '/opt/frontend/dist';
|
||||
@@ -19,6 +25,9 @@ app.use((err, req: Request, res: Response, next: NextFunction) => {
|
||||
res.status(500).json({ msg: 'an error occurred' });
|
||||
});
|
||||
|
||||
nodesched.scheduleJob('regenerate data', '*/30 * * * * *', wxService.wrappedGenerateData)
|
||||
wxService.wrappedGenerateData();
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(
|
||||
`application is listening on port ${PORT}`,
|
||||
|
||||
Reference in New Issue
Block a user