📜  express sendfile 根路径 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:29.450000             🧑  作者: Mango

代码示例1
const express = require('express');

const app = express();

app.get('/', (req, res) => {
//send file root path index.html
  res.sendFile('index.html', { root: __dirname });
});

app.listen(3000, () => {
  console.log('Running ws://localhost:3000');
});