Joel Spolsky presents: Glitch gets confused!

Plot:
Justin is trying to host a Discord bot. However, he has realized he needs to set up a server in Glitch. He tries, but Glitch gets confused! It thinks he has used the code line twice, but Justin has looked carefully at the code, and concludes that it listens on only one line. He goes to the Glitch support, hoping to get help.

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

app.use(express.static("public"));

app.get("/", (request, response) => {
  console.log(`${Date.now()} Ping recieved`);
  response.sendStatus(200);
});

let listener = http.createServer(app).listen(process.env.PORT, async () => {
  console.log(`Bot is listening on port ${listener.address().port}`);
});

setInterval(() => {
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me`);
}, 280000);
1 Like

Shadow walks in, and notices Justin. He wonders what’s happening, and see’s Justin’s code. He wonders what error Glitch is giving Justin when Glitch confused, because he doesn’t understand why it thinks Justin has used the code line twice. He hopes that Justin can show him the error.

bahahahaha i love this

Well I’ll stop…

// Throws Error: listen EADDRINUSE: address already in use :::3000
const express = require("express");
const http = require("http");
const app = express();

app.use(express.static("public"));

app.get("/", (request, response) => {
  console.log(`${Date.now()} Ping recieved`);
  response.sendStatus(200);
});

let listener = http.createServer(app).listen(process.env.PORT, async () => {
  console.log(`Bot is listening on port ${listener.address().port}`);
});

setInterval(() => {
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me`);
}, 280000);

What happens if you visit your project webpage right now?

1 Like

a guy walks into the conversation, wondering what they are talking about and why i’m carrying a microwave with my computer inside

1 Like

Shadow wonders what this new guy is going to do with a microwave, and hopes its making food for everyone

It’ll work if I go to the project webpage. So this will now be solved.

1 Like

Makes food for everyone and hands it out