You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
569 B
30 lines
569 B
// web server
|
|
import express from 'express'
|
|
|
|
// database
|
|
import DB from './db/DB.js'
|
|
import { Model } from 'objection'
|
|
|
|
// middleware
|
|
import ErrorMiddleware from './middleware/errors.js'
|
|
|
|
// database setup
|
|
Model.knex(DB)
|
|
|
|
// webserver setup
|
|
const app = express()
|
|
app.use(express.json())
|
|
|
|
// routes
|
|
import rootRouter from './routes/root.js'
|
|
import mapsRouter from './routes/maps.js'
|
|
import pointsRouter from './routes/points.js'
|
|
|
|
app.use(rootRouter)
|
|
app.use('/m', mapsRouter)
|
|
app.use('/p', pointsRouter)
|
|
|
|
// error middleware
|
|
app.use(ErrorMiddleware)
|
|
|
|
export default app
|
|
|