UNPKG

842 BPlain TextView Raw
1import path = require("path")
2import { Server } from "@proerd/nextpress/lib/server"
3import { ContextFactory } from "@proerd/nextpress/lib/context"
4import { websiteContext } from "@proerd/nextpress/lib/context/mappers/website"
5import { mailgunContext } from "@proerd/nextpress/lib/context/mappers/mailgun"
6import { 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
24process.on("unhandledRejection", (...arg: any[]) => {
25 console.error("unhandledRejection", ...arg)
26 process.exit(1)
27})