Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import express from 'express';
- import { dirname, join } from "path";
- import { fileURLToPath } from "url";
- const __dirname = dirname(fileURLToPath(import.meta.url));
- const app = express();
- app.set('view engine', 'hbs');
- app.set('views', join(__dirname, 'views'));
- app.use(express.static(join(__dirname, "public")));
- app.use(express.urlencoded({ extended: true }));
- app.get("/", (req, res) => {
- res.render("index", { title: "Main Page" })
- });
- app.get("/breeds", (req, res) => {
- res.render("breeds", { title: "Cat Breeds" })
- });
- app.get("/adoption", (req, res) => {
- res.render("adoption", { title: "Adoption" })
- });
- app.listen(3000, () => {
- console.log('Server is running at http://localhost:3000');
- });
Advertisement
Add Comment
Please, Sign In to add comment