const express = require('express'),
app = express();
app.use(express.static(__dirname + '/public'));
app.set('view engine', 'jade');
app.set('views', './views');
app.get('/', (req, res) => {
res.render('index')
});
app.listen(3000);
console.log('listening on port 3000');
index.jade文件:
doctype
html
head
title Home
link(rel='stylesheet', href='css/style.css')
body
header
h1 Home
footer
p Designed By Me
当我在localhost:3000 /加载浏览器时,我得到404,无法加载" localhost:3000 / css / style.css"。是什么问题???
目录结构:
根
公共
app.js
视图
日Thnx