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.
26 lines
817 B
26 lines
817 B
import { EXPORTED_PATH } from './config'; |
|
import { router as tasksRouter } from './routes/tasks'; |
|
import { router as statusRouter } from './routes/status'; |
|
import { router as deleteRouter } from './routes/delete'; |
|
import { port } from './config'; |
|
|
|
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); |
|
|
|
app.use('/api/static', express.static(EXPORTED_PATH)); |
|
app.use('/', (req, res) => { res.send('Grafana-data-exporter server works') }); |
|
|
|
app.listen(port, () => { |
|
console.log(`Server is running on :${port}`); |
|
})
|
|
|