App.get doesn't work for my project

Hey all,

I recently purchased premium hosting to keep my bots alive. I am not interested in talking about whether it is worth it or not. Glitch’s Support Team directed me here since they don’t have an answer.

I seem to be having difficulty getting a front end working such as:

app.get("/ping", (request, response) => { console.log(request); response.sendStatus(200); });

I have tried with and without a “/”. But the project’s name.glitch.me/ping only shows starting up, as do all other pages. No app.get’s for me work at all. Any reason why?

@Fyrlex Can we see the whole code? For example, your project needs to listen for any requests made to it.

I have some commented code that was used when ping services were allowed but I’m not too confident on what to keep.

//const date = mdate.toLocaleString().split("GMT")[0].trim()
// app.use(bodyParser.json())
//app.get("/ping", (request, response) => {
 // const date = new Date().toLocaleString().split("GMT")[0].trim()
 // console.log(date + " PING");
 // response.sendStatus(200);
//});
// const listener = app.listen(process.env.PORT);
const server = http.createServer(app)
// setInterval(() => {
 // http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
//}, 900000);

Uncomment the const listener line so the projects listens for requests :slight_smile:

2 Likes

And the const sever line as well :slight_smile: @Fyrlex

I think that is what is causing the project to remain at “Starting”.