Pravee7094
Active Member
Hi all,
I wrote an API for mobile application (developed by B4A) using Slim Framework (PHP).
API model Example :
This code is used to Get the users username from the table.
Can I write an API in B4J like the API model example?
I tried B4J with my B4A application. I learned JRDC2 Remote connection database. But in the JRDC2, I can run only one query in config.properties.
But I have to write the one function for one operation like above example API coding.
Can I do that with B4J?
Any suggestion or Reference?
Thanks
I wrote an API for mobile application (developed by B4A) using Slim Framework (PHP).
API model Example :
PHP:
$app->get('/filname/getallusers', function (Request $request, Response $response)
{
$db = $this->get(PDO::class);
$sql = "SELECT username FROM talbename";
$exec_sql = $db->prepare($sql);
$exec_sql->execute();
$data = $exec_sql->fetchAll(PDO::FETCH_ASSOC);
$data_encode = json_encode($data);
$response->getBody()->write($data_encode);
return $response->withHeader('Content-Type', 'application/json');
});
This code is used to Get the users username from the table.
Can I write an API in B4J like the API model example?
I tried B4J with my B4A application. I learned JRDC2 Remote connection database. But in the JRDC2, I can run only one query in config.properties.
But I have to write the one function for one operation like above example API coding.
Can I do that with B4J?
Any suggestion or Reference?
Thanks