node.js - 静态 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)
你能给我一个解决方案吗?
解决方案
推荐阅读
- c# - 什么是 WPF 的 DataFormats 类中 Xaml 数据格式字段的 UWP 等效项
- amazon-web-services - 在 EMR 上使用笔记本时如何在 PySpark 中包含包?
- swift - 如何在 SpriteKit 中更改变量之前创建延迟
- laravel - Symfony\Component\HttpFoundation\ParameterBag 类的对象无法转换为字符串 -laravel 5.8
- c++ - 将多个对象数组传递给函数
- json - 我想用字符串数组在 Flutter 中解析复杂的 JSON,然后在另一个列表视图中显示
- lotus-domino - 回到 doc.DXL 中?
- javascript - 为什么 Object.seal 允许用户设置器仍然工作,但禁用像 __proto__ 这样的原生设置器?
- swift - 用户将项目插入数据库时如何刷新tableview?
- java - 如何调用另一个 class.java 文件作为对象添加到 JPanel