1 | import path = require("path")
|
2 | import { Server } from "@proerd/nextpress/lib/server"
|
3 | import { ContextFactory } from "@proerd/nextpress/lib/context"
|
4 | import { websiteContext } from "@proerd/nextpress/lib/context/mappers/website"
|
5 | import { mailgunContext } from "@proerd/nextpress/lib/context/mappers/mailgun"
|
6 | import { knexContext } from "@proerd/nextpress/lib/context/mappers/knex"
|
7 | //
|
8 | ;(async () => {
|
9 | const context = ContextFactory({
|
10 | projectRoot: path.resolve(__dirname, ".."),
|
11 | mappers: [ websiteContext, mailgunContext, knexContext ],
|
12 | })
|
13 |
|
14 | await context.database.init({
|
15 | currentVersion: 1,
|
16 | async migration() {},
|
17 | })
|
18 |
|
19 | const server = new Server(context)
|
20 |
|
21 | server.run()
|
22 | })()
|
23 |
|
24 | process.on("unhandledRejection", (...arg: any[]) => {
|
25 | console.error("unhandledRejection", ...arg)
|
26 | process.exit(1)
|
27 | })
|