DBLabs/abitur_list_client/index.js

31 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

const express = require('express')
2023-05-14 15:26:22 +04:00
require('dotenv').config()
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))