GitHub - oatpp/example-crud: A complete example of a "CRUD" service (UserService) built with Oat++. (original) (raw)
Navigation Menu
Appearance settings
- AI CODE CREATION
* GitHub CopilotWrite better code with AI
* GitHub SparkBuild and deploy intelligent apps
* GitHub ModelsManage and compare prompts
* MCP RegistryNewIntegrate external tools - DEVELOPER WORKFLOWS
* ActionsAutomate any workflow
* CodespacesInstant dev environments
* IssuesPlan and track work
* Code ReviewManage code changes - APPLICATION SECURITY
* GitHub Advanced SecurityFind and fix vulnerabilities
* Code securitySecure your code as you build
* Secret protectionStop leaks before they start - EXPLORE
* Why GitHub
* Documentation
* Blog
* Changelog
* Marketplace
- AI CODE CREATION
- BY COMPANY SIZE
* Enterprises
* Small and medium teams
* Startups
* Nonprofits - BY USE CASE
* App Modernization
* DevSecOps
* DevOps
* CI/CD
* View all use cases - BY INDUSTRY
* Healthcare
* Financial services
* Manufacturing
* Government
* View all industries
- BY COMPANY SIZE
- EXPLORE BY TOPIC
* AI
* Software Development
* DevOps
* Security
* View all topics - EXPLORE BY TYPE
* Customer stories
* Events & webinars
* Ebooks & reports
* Business insights
* GitHub Skills - SUPPORT & SERVICES
* Documentation
* Customer support
* Community forum
* Trust center
* Partners
- EXPLORE BY TOPIC
- COMMUNITY
* GitHub SponsorsFund open source developers - PROGRAMS
* Security Lab
* Maintainer Community
* Accelerator
* Archive Program - REPOSITORIES
* Topics
* Trending
* Collections
- COMMUNITY
- Pricing
Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
oatpp / example-crud Public
- Notifications You must be signed in to change notification settings
- Fork65
- Star 119
A complete example of a "CRUD" service (UserService) built with Oat++.
License
119 stars 65 forks Branches Tags Activity
Notifications You must be signed in to change notification settings
Additional navigation options
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| Latest commitHistory88 Commits | |||
| sql | sql | ||
| src | src | ||
| test | test | ||
| utility | utility | ||
| .dockerignore | .dockerignore | ||
| .gitignore | .gitignore | ||
| CMakeLists.txt | CMakeLists.txt | ||
| Dockerfile | Dockerfile | ||
| LICENSE | LICENSE | ||
| README.md | README.md | ||
| azure-pipelines.yml | azure-pipelines.yml |
Repository files navigation
Example-CRUD 
A complete example of a "CRUD" service (UserService) built with Oat++.
In this example:
- How to create CRUD endpoint.
- How to use oatpp ORM - SQLite 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:
Project layout
|- CMakeLists.txt // projects CMakeLists.txt
|- sql/ // SQL migration scripts for SQLite database
|- src/
| |
| |- controller/ // Folder containing REST Controllers (UserController)
| |- db/ // Folder containing the database client
| |- dto/ // DTOs are declared here
| |- service/ // Service business logic classes (UserService)
| |- 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.
Build and Run
Using CMake
Pre Requirements
oatppoatpp-swaggeroatpp-sqlitewith-DOATPP_SQLITE_AMALGAMATION=ONcmake flag.
Note: You may run utility/install-oatpp-modules.sh script to install required oatpp modules.
Build Project
$ mkdir build && cd build
$ cmake ..
$ make
$ ./crud-exe # - run application.
In Docker
$ docker build -t example-crud .
$ docker run -p 8000:8000 -t example-crud
Endpoints
HTML
| HTTP Method | URL | Description |
|---|---|---|
| GET | http://localhost:8000/ | Root page |
| GET | http://localhost:8000/swagger/ui | Swagger UI page |
User Service
| HTTP Method | URL | Description |
|---|---|---|
| POST | http://localhost:8000/users | Create new User |
| PUT | http://localhost:8000/users/{userId} | Update User by ID |
| GET | http://localhost:8000/users/{userId} | Get User by ID |
| DELETE | http://localhost:8000/users/{userId} | Delete User by ID |
| GET | http://localhost:8000/users/offset/{offset}/limit/{limit} | Get All Users with Paging |
About
A complete example of a "CRUD" service (UserService) built with Oat++.
Topics
orm cpp swagger-ui sqlite3 crud-api oatpp
Resources
License
Stars
Watchers
Forks
Releases13
1.3.0-latest Latest Apr 21, 2024
Packages
No packages published