Examples
#This Website
This website runs with Zack! The file-based routing for the website is very simple and looks like this:
routes/
├─ development.md
├─ doc.md
├─ examples.php
└─ index.php
And also the folder with the necessary twig views looks manageable:
views/
├─ base.html.twig
├─ examples.html.twig
└─ index.html.twig
In this example, the two Markdown files are automatically converted to HTML and output, while the PHP files are rendered and output using Twig.
#Petstore OAS 3.0
As an API example, we have (more or less) implemented the endpoints of the Swagger Petstore - OpenAPI 3.0 specification.
The file-based routing for the API looks as follows:
routes/api/petstore3/
├─ pet
│ ├─ [petId]
│ │ ├─ index.delete.json
│ │ ├─ index.get.json
│ │ ├─ index.post.json
│ │ └─ uploadImage.post.json
│ ├─ findByStatus.get.json
│ ├─ findByTags.get.json
│ ├─ index.post.json
│ └─ index.put.json
├─ store
│ ├─ order
│ │ ├─ [orderId]
│ │ │ ├─ index.delete.json
│ │ │ └─ index.get.json
│ │ └─ index.post.json
│ └─ inventory.get.json
└─ user
├─ [username]
│ ├─ index.delete.json
│ ├─ index.get.json
│ └─ index.put.json
├─ createWithList.post.json
├─ index.post.json
├─ login.get.json
└─ logout.get.json
Click on the endpoints below to see the requests and responses in detail.
pet Everything about your Pets.
PUT
/api/petstore3/pet
Update an existing pet.
POST
/api/petstore3/pet
Add a new pet to the store.
GET
/api/petstore3/pet/findByStatus
Finds Pets by status.
GET
/api/petstore3/pet/findByTags
Finds Pets by tags.
GET
/api/petstore3/pet/{petId}
Find pet by ID.
POST
/api/petstore3/pet/{petId}
Updates a pet in the store with form data.
DELETE
/api/petstore3/pet/{petId}
Deletes a pet.
POST
/api/petstore3/pet/{petId}/uploadImage
Uploads an image.
store Access to Petstore orders.
GET
/api/petstore3/store/inventory
Returns pet inventories by status.
POST
/api/petstore3/store/order
Place an order for a pet.
GET
/api/petstore3/store/order/{orderId}
Find purchase order by ID.
DELETE
/api/petstore3/store/order/{orderId}
Delete purchase order by ID.
user Operations about user.
POST
/api/petstore3/user
Create user.
POST
/api/petstore3/user/createWithList
Creates list of users with given input string.
GET
/api/petstore3/user/login
Logs user into the system.
GET
/api/petstore3/user/logout
Logs out current logged in user session.
GET
/api/petstore3/user/{username}
Get user by user name.
PUT
/api/petstore3/user/{username}
Updated user.
DELETE
/api/petstore3/user/{username}
Delete user.