-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
34 lines (28 loc) · 833 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { knex } from "./config/database";
import express from "express";
import { json } from "body-parser";
import morgan from "morgan";
import cors from "cors";
export const app = express();
app.use(morgan("dev"));
app.use(json());
app.use(cors());
app.get("/status", req => req.res.send("ONLINE"));
import { router as customer } from "./routes/customer";
import { router as item } from "./routes/item";
import { router as order } from "./routes/order";
app.use("/customer", customer);
app.use("/item", item);
app.use("/order", order);
// istanbul ignore next
export const start = _ => {
// istanbul ignore next
console.log("updating migrations...");
// istanbul ignore next
knex.migrate.latest().then(_ => {
console.log("done!");
app.listen(3000, _ => {
console.log("server online!");
});
});
};