import express from 'express'
import bodyParser from 'body-parser'
import cors from 'cors'
import dbRouter from './api/db'
import generalRouter from './api/general'
import gisRouter from './api/gis'
import nodesRouter from './api/nodes'
import tilesRouter from './api/tiles'
import staticRouter from './api/static'
import 'dotenv/config'

const app = express()
const PORT = process.env.EMS_PORT || 5000

app.use(cors())

app.use(bodyParser.json())

app.use(bodyParser.urlencoded({ extended: true }))

app.use('/db', dbRouter)
app.use('/general', generalRouter)
app.use('/gis', gisRouter)
app.use('/nodes', nodesRouter)
app.use('/tiles', tilesRouter)
app.use('/static', staticRouter)

app.listen(PORT, () => console.log(`Server running on port ${PORT}`));