Answer the question
In order to leave comments, you need to log in
How to interact with slim framework from vue?
Hello! The question is probably stupid, but I can not figure out how to get data from slim from vue.
For example, there is such a code of the index.php file in the server folder
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../../vendor/autoload.php';
$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
$name = $request->getAttribute('name');
$response->getBody()->write("Hello, $name");
return $response;
});
$app->get('/hi/{name}', function (Request $request, Response $response) {
$name = $request->getAttribute('name');
$response->getBody()->write("Hello, $name");
return $response;
});
$app->run();
test: function(){
axios.post('server/hello/anton', {
}).then(response => {
console.log(response.data);
});
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question