Link - https://necessary-frequent-motorcycle.glitch.me
My webapp has just suddenly stopped rendering the page and started just showing the raw HTML. I haven’t changed anything on the server.js
file except for adding the following code to config responses to json rather than text;
app.use((req, res, next) => {
res.setHeader("Content-Type", "application/json");
next();
});
The issue started when I began creating the test suites for Mocha/Chai testing.
Any help would be appreciated 
This may not be the issue, but usually, I use
app.get('/', (req, res) => {
});
instead of app.use
Just for reference I have managed to fix the issue:
const options = {
setHeaders: function (res, path, stat) {
res.set("Content-Type", "application/json")
}
};
app.use('/public', express.static(process.cwd() + '/public', options));
In my post, I put the options in a separate app.use rather than where it should be in the express.static middleware.
3 Likes
Have you been using glitch since it was called HyperDev?! That’s so cool! Could see it in the code