I get “To keep Glitch fast for everyone, inactive projects go to sleep and wake up on request.” when I press “Show” on my express project. It does not go away. I expect to see my views/index.html page but instead, I get the page above. I tried making my server js not go in an infinite loop, but it doesn’t remove the persistence of the message. In the console, I also get “GET https://citrine-restaurant.glitch.me/favicon.ico 504” as an error no matter what. Please help, Frank-9976.
You haven’t specified a port to listen for requests. Also, your code isn’t returning after finishing the request, so it will just hang and then timeout. I suggest running the request within a route like:
var express = require('express');
var app = express();
app.get("/", function (request, response) {
// your request //
response.sendStatus(200);
});
// listen for requests :)
var listener = app.listen(process.env.PORT, function () {
console.log('Your app is listening on port ' + listener.address().port);
});
I can’t reproduce your console issue. What browser and OS version are you uisng?
Whoops, forgot to specify I’m on Version 70.0.3538.102 (Official Build) (64-bit) of Chrome on Windows 7 Home Premium.
Whoops, I just realized one of my functions was named “process”. Coincidentally, that is a critical server variable. What an oof, as they say.
Anyway, now I get the error, 22 of
Refused to load the font ‘’ because it violates the following Content Security Policy directive: “default-src ‘self’”. Note that ‘font-src’ was not explicitly set, so ‘default-src’ is used as a fallback.
and only one of
citrine-restaurant.glitch.me/:1 Failed to load resource: the server responded with a status of 404 ()
in the console, and
Cannot GET /
in the actual page. Progress, though!
You get ‘Cannot GET /’ because you haven’t defined a route for the root URL. In the code I provided above, this part does that:
app.get("/", function (request, response) {
// your request //
response.sendStatus(200);
});
Ah, that is a handler to handle requests, not to send requests. I see now, that was my confusion. How do I actually send the HTML though, all I get is OK on the client with no errors.
I could figure it out, but knowing the ideal way to do it is probably better.
In the mean time, I’ll be figuring it out.