2020-02-07 16:55:43 +00:00
|
|
|
const express = require("express");
|
2020-02-09 10:59:23 +00:00
|
|
|
const helmet = require('helmet');
|
|
|
|
const cors = require('cors');
|
2020-02-07 16:55:43 +00:00
|
|
|
|
2020-02-08 18:59:51 +00:00
|
|
|
const citiesRouter = require('./routes/citiesRouter');
|
|
|
|
const roadsRouter = require('./routes/roadsRouter');
|
|
|
|
const countriesRouter = require('./routes/countriesRouter');
|
|
|
|
const pathRouter = require('./routes/pathRouter')
|
|
|
|
|
2020-02-07 16:55:43 +00:00
|
|
|
const server = express();
|
|
|
|
|
2020-02-09 10:59:23 +00:00
|
|
|
server.use(helmet());
|
2020-02-07 16:55:43 +00:00
|
|
|
server.use(express.json());
|
2020-02-09 10:59:23 +00:00
|
|
|
server.use(cors());
|
2020-02-07 16:55:43 +00:00
|
|
|
|
2020-02-08 18:59:51 +00:00
|
|
|
server.use('/api/cities', citiesRouter);
|
|
|
|
server.use('/api/roads', roadsRouter);
|
|
|
|
server.use('/api/countries', countriesRouter);
|
|
|
|
server.use('/api/path', pathRouter);
|
2020-02-07 16:55:43 +00:00
|
|
|
|
|
|
|
module.exports = server;
|