I have been doing research and nothing I have found has made any sense to me. I am totally new to laravel and I am wanting to use it as a backend to my AngularJS. I have good experience with angular so here is my controller function making the http call:
var jsonData = {
text: "test"
};
$http.post("http://127.0.0.1:8000/submit", {
data: jsonData
}).then(function(response) {
console.log("SUCCESS");
})
And then here is my route in file api.php
:
Route::post('/submit', function(Request $request) {
$data = $request->input('data');
return $data;
});
So then I run php artisan serve
and the console says Laravel development server started: <http://127.0.0.1:8000>
. I try to reach the server via angular and nothing happens. I was wondering if someone can help me figure out what I am doing wrong? How can I post my data from angular to laravel and then send it back to my angular?