添加静态文件夹

This commit is contained in:
赵鑫 2022-08-26 12:32:33 +08:00
parent d9c7a93aca
commit c81f6df88d
2 changed files with 2 additions and 1 deletions

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -9,9 +9,10 @@ mongoose.connect(MONGDB_URL, (error) => {
} }
}) })
const app = express() const app = express()
app.use(express.static('public'))
app.set('view engine', 'pug') app.set('view engine', 'pug')
app.get('/', async (req, res) => { app.get('/', async (req, res) => {
res.render('index', { title: 'hello, world!' }) res.render('index', { title: '文件分享服务器' })
}) })
const server = app.listen(SERVER_PORT, SERVER_HOST, () => { const server = app.listen(SERVER_PORT, SERVER_HOST, () => {
console.info(`server is running at http://${SERVER_HOST}:${SERVER_PORT}`) console.info(`server is running at http://${SERVER_HOST}:${SERVER_PORT}`)