这是代码,它告诉我输出无法获取/demo.pug
//import modules here
const express = require("express");
const http = require("http");
const fs = require("fs");
const path = require("path");
const port = 8020;
const app = express();
//express specific stuff
app.use('/static', express.static('static')); //for static files
//pug specific stuff
app.set('view engine', 'pug') // set the engine in pug
app.set("views", path.join(__dirname, "views")); //set the views directory
//Endpoints
app.get("/demo", (req, res) => {
res.render('demo', { title: 'Hey', message: 'Hello there! thanks for teaching me how to use pub' })
});
// Start the server
app.listen(port, () => {
console.log("the application started successfully");
});