mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-15 19:00:36 -05:00
36 lines
803 B
JavaScript
36 lines
803 B
JavaScript
const express = require('express');
|
|
|
|
const app = express();
|
|
const {
|
|
catchAll,
|
|
pareto,
|
|
pr,
|
|
search,
|
|
info,
|
|
getCurrData,
|
|
upload
|
|
} = require('./routes');
|
|
|
|
app.use(express.static('public'));
|
|
app.use((request, response, next) => {
|
|
response.header('Access-Control-Allow-Origin', '*');
|
|
response.header(
|
|
'Access-Control-Allow-Headers',
|
|
'Origin, X-Requested-With, Content-Type, Accept'
|
|
);
|
|
response.header('Access-Control-Allow-Methods', 'GET');
|
|
next();
|
|
});
|
|
|
|
app.use('/pr', pr);
|
|
app.use('/search', search);
|
|
app.use('/pareto', pareto);
|
|
app.use('/info', info);
|
|
app.use('/getCurrData', getCurrData);
|
|
app.use('/upload', upload);
|
|
app.use('*', catchAll);
|
|
|
|
const listener = app.listen(process.env.PORT, () => {
|
|
console.log('Your app is listening on port ' + listener.address().port);
|
|
});
|