A complete example of a "CRUD" API secured with JSON Web Token (JWT) built with Oat++ and jwt-cpp.
In this example:
- How to create CRUD endpoints.
- How to secure endpoints with JWT.
- How to use Oat++ ORM - PostgreSQL example.
- How to document API with Swagger-UI and OpenApi 3.0.0.
More about Oat++:
This project is using the following oatpp modules:
- OpenSSL
- jwt-cpp.
|- CMakeLists.txt // projects CMakeLists.txt
|- sql/ // SQL migration scripts
|- src/
| |
| |- controller/ // Folder containing REST Controllers (AuthController, StoryController)
| |- db/ // Folder containing database clients
| |- dto/ // DTOs are declared here
| |- service/ // Service business logic classes (AuthService, StoryService)
| |- AppComponent.hpp // Service config
| |- DatabaseComponent.hpp // Database config
| |- SwaggerComponent.hpp // Swagger-UI config
| |- App.cpp // main() is here
|
|- test/ // test folder
|- utility/install-oatpp-modules.sh // utility script to install required oatpp-modules.