Project not starting, but it works with my other bot

So my bot runs on Glitch (discord.js) and I happen to attempt to run it 24/7 with this code in server.js:

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

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

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

It will not run, not even if I had the tab open, and I made sure I had no errors. I had another bot with the same code that runs 24/7 with the same code. I also made sure I had this in index.js (my main bots file): const server = require('./server.js'); const app = express();
I don’t know what went wrong in my thinking.

The server.js looks fine on its own, but its not exporting anything, so change the above code in your index.js to …


Or if you want to export the app from the server module, add to server.js

module.exports = app;

Then in index.js

const app = require('./server.js');

Thank you! It’s working!