added dockerfile

This commit is contained in:
Mike 2024-12-26 07:27:38 -05:00
parent 15a77883f4
commit eb3068af96
4 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,13 @@
FROM node:23-alpine
COPY . /app
WORKDIR /app
RUN npm install .
EXPOSE 3000
CMD ["node", "src/app.js"]

View file

@ -0,0 +1,3 @@
node_modules/
Dockerfile
package-lock.json

View file

@ -13,6 +13,8 @@ app.set("view engine", "ejs");
const assetsPath = path.join(__dirname, "public"); const assetsPath = path.join(__dirname, "public");
app.use(express.static(assetsPath)); app.use(express.static(assetsPath));
app.use(express.urlencoded({ extended: true }));
app.use("/", indexRouter); app.use("/", indexRouter);
//app.use("/new", msgRouter); //app.use("/new", msgRouter);

View file

@ -34,7 +34,11 @@ indexRouter.get("/new", (req, res) => {
}); });
indexRouter.post("/new", (req, res) => { indexRouter.post("/new", (req, res) => {
console.log(req); messages.unshift({
text: req.body.message,
user: req.body.username,
added: new Date(),
});
res.redirect("/"); res.redirect("/");
}); });