User Tools

Site Tools


Create an API Endpoint

Inside /src/api/ we begin by creating a file for our API endpoint

* @description My new api end point
* @tags items, testing
\Tina4\Get::add("/api/items", function(\Tina4\Response $response) {
  $items = ["one", "two", "three"];
  return $response($items, HTTP_OK, APPLICATION_JSON)

Accessing our Endpoint

To access our enpoint we will navigate to the relevant path in our browser. E.g. http://localhost:7145/api/items Also the swagger UI for all your annotated endpoints can be found at http://localhost:7145/swagger

basic-api.txt · Last modified: 2021/06/13 19:20 by andre