这是我的代码:
I want to hide my folder from client and put alias before file name
const express = require('express');
const path = require('path');
const app = express();
app.use('/public',express.static(path.join(__dirname,'static')));
app.get('/',(req,res)=> {
res.sendFile(path.join(__dirname,'static','index.html'));
}).listen(3000);
在 chrome 上检查时,它应该给出:
<link rel='stylesheet' href='/public/css/main.css'>
<script src='/public/js/example.js'></script>
But it is giving me:
<link rel='stylesheet' href='main.css'>
<script src='example.js'></script>