Skip to content

VaporExamplesLab/Example-SO-VaporJsonResponse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example-SO-VaporJsonResponse

Example-SO-VaporJsonResponse provides a working example for the StackOverflow question "Making Vapor API response JSON API Spec compliant".

Each class and/or struct in the compound object ApiResponse complies with the Content protocol. The Content protocol includes the Codable protocol for JSON decoding and encoding.

The POST was checked with the RESTed macOS application using the file "Dish.request".

curl -i -X POST "http://127.0.0.1:8080/api/dish" \
    -H "Content-Type: application/json" \
    -d '{"course": "salad", \
        "description": "flavorful Southwestern ethos", \
        "price": 1.82, "title": "Aztec Salad"}'

About

Working example for StackOverflow question "Making Vapor API response JSON API Spec compliant".

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages