#Laravel API endpoints

10 messages · Page 1 of 1 (latest)

versed elbow
#

Hey guys, I'm new to laravel and would like to be debugged since I've been stuck the past 1 hour. I'll post a code here and explain what I'm trying to do. If anyone can help me I'd appreciate it

  1. I am trying to write code for getting data and posting in an API. I have two functions, [postRequest()] which gets what I want to use as headers in the function [another function()]. I have attached pictures.

However, when I do, even though the data is stored , its getting a timed up response in and that it does not take enough arguments even though I have passed the stored data.

Please help.

empty jolt
#

You're making a request to your own app..? What's the benefit of that?
Also, if you're using php artisan serve or Sail that simply won't work, since both of those are single threaded, they can only process a single request at a time. So making a request within another request will just cause a timeout

#

Oh and also have a little bit of patience.. You just posted it and already bumping it in other places, while I was typing a reply..

versed elbow
empty jolt
versed elbow
empty jolt
# versed elbow I am trying to come up with some functionality for another app that I'm not allo...

I am trying to come up with some functionality for another app that I'm not allowed to mess with hence I used the local host.
So there's two different apps then? Then I guess make sure you're making a request to the second app, not the same app
Would you say the code is alright and might work if the request was being made to an already set up and deployed application?
Probably not, because it wouldn't be served on localhost with that port. And if it does the setup is probably not correct.

versed elbow
#

Oh okay. Lemme check on that. Thanks for the help

mental edge
#

If you want to locally test one app sending requests to another app, set up two local apps

empty jolt
#

And also using a config value, getting the base URL from .env, that way you can deploy and set the correct base URL without the need to change code