Api not running
hey!, I am trying to create a api.
What i have so far:
and
20 Replies
the problem is its not running
i also have api dir which have
first of all name the file
.get.ts
and the method will only ever be a GET request.
and what do you mean "not running". have you tried sending a curl to localhost:3000? what does it give as response?like that?
index.get.ts:
yes
PS E:\dev\kate> curl -v http://localhost:3000/api
* Host localhost:3000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:3000...
* Trying 127.0.0.1:3000...
* connect to ::1 port 3000 from :: port 53881 failed: Connection refused
* connect to 127.0.0.1 port 3000 from 0.0.0.0 port 53882 failed: Connection refused
* Failed to connect to localhost port 3000 after 2251 ms: Could not connect to server
* closing connection #0
curl: (7) Failed to connect to localhost port 3000 after 2251 ms: Could not connect to server
PS E:\dev\kate>
if that is in the routes directory thate would be
localhost:300/api/
still
that's weird
sec
tyt
try setting just
/
as prefix
or hmsame issue
the funny thing is
actually works. and it saying
2025-04-25 20:28:43 - INFO - API server is running on http://localhost:3000/api/
YO
i got it
this bitch
idk if this related but it now saying
{"ok":true}
now the routes not working omfgthat's weird though, that should be automatic with the automaticallyConnect which is also true by default btw
it was false
lmao
you had it true here
yeah ur right, its now working
now the route should be /me? right?
because prefix is /
yeah you can change it back to /api/
yeah so with prefix of
/api/
both /api
and /api/
should work
I had some trouble setting up my test bot where I apparently didnt upgrade the plugin correctly before

anyway you only need to set
automaticallyConnect
to false and check for shard id if you use a third party library for sharding. You dont need to do that for DiscordJS internal sharder
and if you dont do sharding at all then you really dont need toohh
yeah i get it
thank you so much
fuck, shapphire is perfect lmao
❤️