Glitch.me project appears down even though not - Uptime robot

stuck

Hello, I’ve seen some suggestions here saying Uptime Robot will help keep my bot alive. My uptime robot says my app is down (even though I know from discord server that it is online). I’m uploading the screenshot of my “projectname.glitch.me” site. Basically it’s stuck like that. Even though I didn’t edit index.html, the default page is should be different.

Is it possibly because I changed my project name to something non-unique 2 days ago?

1 Like

Hi, what’s your project name so I can take a look at the code?

Hi @Nameless9! Chances are that your projects server isn’t serving up a default route. For example if you’re using Express to serve your public pages you’ll need something that looks like

app.get('/', function(request, response) {
  response.sendFile(__dirname + '/views/index.html');
});

And something that looks like

const listener = app.listen(process.env.PORT, function() {
  console.log('Your app is listening on port ' + listener.address().port);
});

If you’re missing those pieces your app’s public page will never load.

As @levistep32 points out, knowing your project name will help us give more specific answers.

Thank you for your replies. You are right. I didn’t make a routing for my discord.js bot yet, so that’s a logical explanation. My project name is geniusbot.

Edit: I’m not using Express yet. So I guess I should install express and follow the guide on routing?

You’ve actually got Express already installed so that’s a start. You could put this in place by creating a file called server.js with these contents:

const express = require("express");
const app = express();

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

// listen for requests :)
const listener = app.listen(process.env.PORT, function() {
  console.log('Your app is listening on port ' + listener.address().port);
});

and then in bot.js include this line:
const server = require('./server.js');

Then your bot will have an empty web page responding at https://geniusbot.glitch.me that UptimeRobot can ping.

1 Like

thank you for your help cori. the website is up and it looks like it’s good from uptime robot’s side too. thanks again

Hello it does not work for me
my bot keep going offline wen i close visualisation studio code

Hi @wolfgirl416, welcome to the Glitch Forums!

UptimeRobot won’t keep your bot itself running, just the project that’s hosting it; there are any number of reason the project might be running but the bot not.

I’m not quite sure how Visual Studio Code is related to the problem you’re seeing, but maybe you can tell us more about how VS Code is involved? Also your project name might help, and a snapshot of your UptimeRobot config if you think that might not be working.