diff --git a/packages/vanilla/server.js b/packages/vanilla/server.js index 67f03afa..a7aef378 100644 --- a/packages/vanilla/server.js +++ b/packages/vanilla/server.js @@ -1,4 +1,8 @@ import express from "express"; +import path from "path"; +import { fileURLToPath } from "url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const prod = process.env.NODE_ENV === "production"; const port = process.env.PORT || 5173; @@ -6,6 +10,10 @@ const base = process.env.BASE || (prod ? "/front_7th_chapter4-1/vanilla/" : "/") const app = express(); +// Middleware +app.use(express.json()); +app.use(express.static(path.join(__dirname, "public"))); + const render = () => { return `