My index.js project doesn't display my website, displays "Starting" only

So, I have a Discord bot from a source code:

I don’t know, how would I add, that when you visit my link it would show website so it can also be woken up with Uptime Robot (It displays that the site is down right now).

How would I do that?
I’ve added views/index.html
and that code to index.js

const app = express();

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

Note that index.js is in src folder (as shown on the github project below)
I’ve also run npm install.

How would I do that?

@Wizertex, do you have this code in your package.json:

"scripts": {
    "test": "standard",
    "start": "node src/index.js"

Sadly not working … Any other solutions?

Make sure to add app.listen(process.env.PORT) to your index.js

So I managed to successfully add the glitch hosted bot unto the discord server.

Here is how we can accomplish this.
Ensure you do the following:

  1. Import the link through git import

  2. On Glitch, open the console and run npm install

  3. On Discord, create an application on discord

  4. Create a bot on the application in discord

  5. Copy the bot token

  6. Go back to glitch, find the file .gitignore, delete the src/data/* & src/data/client.json (located top and bottom of file

  7. Refresh your page

  8. Edit the src/data/client.json file to add in the bot token, this will ensure the server is pointing to the a bot of your creation

  9. Now, your server should be hosted and successful and we are ready to generate the link to add the bot to your discord servers

  10. Go back to the discordapp developers applications

  11. Under the OAuth tab, click on the “bot” checkbox under scopes

  12. A list of bot permissions will show up, select the following

  13. Save the changes

  14. Copy the url provided and enter it in your favourite browser

  15. VOILA!!

Hope this helps you and earned me some thanks! I want to try out glitch’s custom domain feature so do thank me if this helps you out!

Thanks for your help, but the bot is already working. Problem is the website that should appear when you visit the link.

Did it, but now got this TypeError: path must be absolute or specify root to res.sendFile

__dirname gets the path of the module, i.e. the path of index.js is /app/src

Depending on how you run index.js, you could use dot “.” for current directory:


Or just leave the dot out and it will start with the current directory:


Or if this doesn’t work, you could tell it where in the project it is:

1 Like