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.

27 lines
817 B

6 years ago
import { EXPORTED_PATH } from './config';
import { router as tasksRouter } from './routes/tasks';
import { router as statusRouter } from './routes/status';
6 years ago
import { router as deleteRouter } from './routes/delete';
import { port } from './config';
6 years ago
import * as express from 'express';
import * as bodyParser from 'body-parser';
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// TODO: move everything with /api prefix to an apiRouter
app.use('/api/status', statusRouter);
app.use('/api/tasks', tasksRouter);
app.use('/api/delete', deleteRouter);
6 years ago
app.use('/api/static', express.static(EXPORTED_PATH));
app.use('/', (req, res) => { res.send('Grafana-data-exporter server works') });
6 years ago
app.listen(port, () => {
console.log(`Server is running on :${port}`);
6 years ago
})