-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
28 lines (25 loc) · 882 Bytes
/
app.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
const express = require("express");
const path = require("path");
const app = express();
app.use(express.static(path.resolve(__dirname, "./public")));
app.use(express.urlencoded({ extended: false }));
app.listen(process.env.PORT || 3000, () => { //levanta el servidor usando una variable de entorno O el puerto 3000
console.log("Servidor corriendo en el puerto 3000...")
})
app.get("/", (req, res) => {
res.sendFile(path.resolve(__dirname, "./views/home.html"))
})
app.get("/register", (req, res) => {
res.sendFile(path.resolve(__dirname, "./views/register.html"))
})
app.get("/login", (req, res) => {
res.sendFile(path.resolve(__dirname, "./views/login.html"))
})
app.post("/login", (req, res) =>{
console.log(req.body)
res.redirect("/");
})
app.post("/register", (req, res) =>{
console.log(req.body)
res.redirect("/");
})