Skip to content

Commit add2228

Browse files
Fix morgan logging (#123)
1 parent 7c7a21d commit add2228

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

node-custom-server/server.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (DEVELOPMENT) {
1717
const viteDevServer = await import("vite").then((vite) =>
1818
vite.createServer({
1919
server: { middlewareMode: true },
20-
})
20+
}),
2121
);
2222
app.use(viteDevServer.middlewares);
2323
app.use(async (req, res, next) => {
@@ -35,14 +35,13 @@ if (DEVELOPMENT) {
3535
console.log("Starting production server");
3636
app.use(
3737
"/assets",
38-
express.static("build/client/assets", { immutable: true, maxAge: "1y" })
38+
express.static("build/client/assets", { immutable: true, maxAge: "1y" }),
3939
);
40+
app.use(morgan("tiny"));
4041
app.use(express.static("build/client", { maxAge: "1h" }));
4142
app.use(await import(BUILD_PATH).then((mod) => mod.app));
4243
}
4344

44-
app.use(morgan("tiny"));
45-
4645
app.listen(PORT, () => {
4746
console.log(`Server is running on http://localhost:${PORT}`);
4847
});

node-postgres/server.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (DEVELOPMENT) {
1717
const viteDevServer = await import("vite").then((vite) =>
1818
vite.createServer({
1919
server: { middlewareMode: true },
20-
})
20+
}),
2121
);
2222
app.use(viteDevServer.middlewares);
2323
app.use(async (req, res, next) => {
@@ -35,14 +35,13 @@ if (DEVELOPMENT) {
3535
console.log("Starting production server");
3636
app.use(
3737
"/assets",
38-
express.static("build/client/assets", { immutable: true, maxAge: "1y" })
38+
express.static("build/client/assets", { immutable: true, maxAge: "1y" }),
3939
);
40+
app.use(morgan("tiny"));
4041
app.use(express.static("build/client", { maxAge: "1h" }));
4142
app.use(await import(BUILD_PATH).then((mod) => mod.app));
4243
}
4344

44-
app.use(morgan("tiny"));
45-
4645
app.listen(PORT, () => {
4746
console.log(`Server is running on http://localhost:${PORT}`);
4847
});

0 commit comments

Comments
 (0)