Path to index.html is wrong and updating it results in javascript errors.
chdalski opened this issue · 2 comments
Starting the server with "npm start" and calling the website results in an error (Error: ENOENT: no such file or directory, stat '.../ms-identity-javascript-v2/index.html').
The index.html can't be found, because it's not located in the root directory.
In server.js:
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname + '/index.html'));
});
should be:
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname + '/app/index.html'));
});
Doing so brings up the website but results in the following java-script errors:
Uncaught SyntaxError: Unexpected token '<' authConfig.js:1
Uncaught SyntaxError: Unexpected token '<' graphConfig.js:1
Uncaught SyntaxError: Unexpected token '<' ui.js:1
Uncaught SyntaxError: Unexpected token '<' authPopup.js:1
Uncaught SyntaxError: Unexpected token '<' graph.js:1
Interesting, I'm not able reproduce this. The server.js
sets up a static files folder first, and serves the index.html
from there. That's why we didn't need to use the full path /app/index.html
// Setup app folders.
app.use(express.static('app'));
// Set up a route for index.html
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname + '/index.html'));
});
Can you replace the wildcard route *
with /
and try again?
// Set up a route for index.html
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname + '/app/index.html'));
});
Closing. Let us know if you need further help.