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.
24 lines
563 B
24 lines
563 B
import * as bodyParser from "body-parser"; |
|
import * as express from "express"; |
|
|
|
import { ServerState } from "@server/state"; |
|
import createApi from "./api"; |
|
import errorHandler from "./errorHandler"; |
|
import requestLogger from "./requestLogger"; |
|
import serveApp from "./serveApp"; |
|
|
|
export function createApp(state: ServerState) { |
|
const app = express(); |
|
|
|
app.use(requestLogger); |
|
app.use(bodyParser.json()); |
|
app.use(bodyParser.urlencoded({ extended: true })); |
|
|
|
app.use("/api", createApi(state)); |
|
|
|
serveApp(app); |
|
|
|
app.use(errorHandler); |
|
|
|
return app; |
|
}
|
|
|