HTTP Service Error

I’m using HTTP Service to send things to a URL to do things backend for my game. I am using the right URL and I keep getting Error 404 (not found)

Here is the code:

local http = game.HttpService

local Data = {

Password = "abc"

}

local newData = http:JSONEncode(Data)

http:PostAsync('', newData)

The error I get:

09:41:34.350 - HTTP 404 (Not Found)

In the backend this is the code

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


app.get("/", (request, response) => {
  response.send("Hello")
});

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

Where am I going wrong?

I don’t know much about node but a quick search tells me that app.get is meant for GET requests, and you’re using PostAsync to send a POST request. Either you meant app.post or GetAsync.

3 Likes

Wow, thank you. I must of just forgot completely about that. Thank you very much :slight_smile:

Might be worth redacting your site URL, to avoid abuse by malicious people.

1 Like