I have my Node.js site running static html and my server.js file is below:
const express = require('express');
const serve = require('express-static');
const app = express();
app.use(serve('/client', {
extensions: ['html']
}));
const server = app.listen(process.env.PORT || 3000, process.env.IP || "0.0.0.0", function(){
console.log('server is running at %s', server.address().port);
});
I'm expecting that when I have a URL of:
http://www.example.com/my-file-name
This is pointing to this static file:
http://www.example.com/my-file-name.html
However, I am getting the following response:
Cannot GET /my-file-name
Am I misunderstanding how Express Static works? Or do I have my server.js file mis-configured?
via tonejac
No comments:
Post a Comment