B. Clones
3. Api-only, with database, no frontend
Again, not much to do.
If you only need API responses from Genes, maybe you're doing something client side, or you're just using some software that needs live JSON data from you, Genes got you covered.
When you put .json at the end of any url in Genes you get JSON API response.
It also works if you do GET and POST to that url.
https://your-own-genes-clone-domain.com/index.json
https://your-own-genes-clone-domain.com/about-us.json
For example if you want to get some data from some other API, and you want to process it and output, the below is an example for that:
g::def("clone", array(
"Index" => function () {
// Let's get a random user from this lovely API.
$url = "https://randomuser.me/api/";
$data = g::run("tools.LoadPathSafe", $url);
$data_arr = g::run("tools.JD", $data);
$row = $data_arr["results"][0];
$result = array(
"name" => $row["name"]["title"] . " " . $row["name"]["first"] . " " . $row["name"]["last"],
"location" => $row["location"]["city"] . ", " . $row["location"]["state"] . ", " . $row["location"]["country"],
"user" => $row["login"]["username"] . ", " . $row["dob"]["age"] . ", " . $row["gender"],
"avatar" => $row["picture"]["large"]
);
g::set("op.data", $result);
g::run("tools.ExitWithOpDataResponse");
}, "Query" => function () {
g::run("ui.LoadViewHtml");
}
));
And just like that, you can get this original API response...

And convert it into whatever you need..

Isn't that nice and sweet?