首页 > 解决方案 > 静态 css 显示在哈巴狗中

问题描述

我通过以下方式链接了 pug 中的 css:

style
include ../static/style.css

它显示在 localhost 静态而不是应用它.. 我的 app.js 编码:

    const express = require("express")
const path = require("path")
const fs = require("fs")
const app = express();
// Importation done
// Express Stuff :::
app.use('/static', express.static('static'))
// app.use(express.urlencoded());

// Express Stuff done
// Pug ::

app.set('view engine', 'pug');
app.set('views', path.join(__dirname, 'views'));

// PUG done
// Endpoints
app.get('/', (req, res)=>{
    res.status(200).render('index.pug')
})
app.listen(80)

你能给我一个解决方案吗?

标签: node.jsexpresspugbackend

解决方案


推荐阅读