DBLabs/abitur_list_client/index.js

30 lines
1.0 KiB
JavaScript

const express = require('express')
const abiturRouter = require('./routes/abitur.routes')
const examResultRouter = require('./routes/examresult.routes')
const specializationRouter = require('./routes/specialization.routes')
const educationFormRouter = require('./routes/educationform.routes')
const requestRouter = require('./routes/request.routes')
const request_examresultRouter = require('./routes/request_examresult.routes')
const PORT = process.env.PORT || 8080
const app = express()
app.use(function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.header("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE");
res.setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
next();
});
app.use(express.json())
app.use('/api', abiturRouter)
app.use('/api', examResultRouter)
app.use('/api', specializationRouter)
app.use('/api', educationFormRouter)
app.use('/api', requestRouter)
app.use('/api', request_examresultRouter)
app.listen(PORT, () => console.log('server started on port ' + PORT))