Hello everyone!
Im looking for the way to host my own .json file like /players.json or /info.json.
Ofc i can just make it by resource and then create virtual link to my web directory and then acces it for example by domain.com/thisfile.json, but im looking for way to acces it by server like domain.com:serverport/thisfile.json.
Any ideas ?
SET_HTTP_HANDLER, typically.
Thanks, but how to use it ? There is nothing in natives for it
https://runtime.fivem.net/doc/natives/#_0xF5C6330C
Maybe look at runcode as example
I already did, i find some like this:
SetHttpHandler(function(req, res)
local path = req.path
if req.path == '/test' then
res.send(json.encode({
test = 'test'
}))
return
end
end)
but its not working
Works here
Ahh, now its working. I tried to get into this by âip:port/testâ instead of âip:port/resourcename/testâ. Now its working perfect, thanks so much, big heart for you <3
Hi here ,
Still working ?
Sure.
Hi,
i used your setup and its not working for me.
/test not responding , its be charging infinite loop
Add resource name in path between port and file name.
Like ip:port/resourcename/test instead of ip:port/test
Like :
localhost:30120/forklift/test ?
I reproduce ur example and doesnt work ^^
I tried also just seems to load infinitely.
Any chance any of you got it working lol?
it was posted above.
Unfortunately the code above doesnât work.
Create your own topic with more info than just âdoesnât workâ e.g. your code and what you tried.