/example-jwt

A complete example of a CRUD service with API secured with JSON Web Token (JWT)

Primary LanguageC++Apache License 2.0Apache-2.0

Example-JWT Build Status

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++:

Overview

This project is using the following oatpp modules:

3rd party dependencies

Project layout

|- 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.