-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[config] write config to serve prodution build from node server
- Loading branch information
1 parent
f85fcf0
commit c5baf48
Showing
3 changed files
with
12 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
import compression from "compression"; | ||
import cookieParser from "cookie-parser"; | ||
import express from "express"; | ||
import cookiesMiddleware from "universal-cookie-express"; | ||
|
||
import routes from "./routes"; | ||
|
||
const app = express(); | ||
const cookiesMiddleware = require("universal-cookie-express"); | ||
const path = require("path"); | ||
|
||
const app = express(); | ||
app.use(compression()); | ||
app.use(express.static(path.join(process.cwd(), "dist"))); | ||
app.use(cookieParser()); | ||
app.use(cookiesMiddleware()); | ||
app.use(express.json()); | ||
app.use(express.urlencoded({extended: false})); | ||
app.use("/api/v1/:organization/account", routes.account); | ||
|
||
app.get("*", function(req, res) { | ||
res.sendFile(path.join(process.cwd(), "dist", "index.html")); | ||
}); | ||
app.listen(3030, () => { | ||
console.log("Server started on port 3030"); | ||
}); |