Skip to content

Commit 1a855af

Browse files
authored
Update README.md
1 parent 6db3315 commit 1a855af

File tree

1 file changed

+21
-36
lines changed

1 file changed

+21
-36
lines changed

README.md

+21-36
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
# example-postgresql [![Build Status](https://dev.azure.com/lganzzzo/lganzzzo/_apis/build/status/oatpp.example-postgresql?branchName=master)](https://dev.azure.com/lganzzzo/lganzzzo/_build/latest?definitionId=17&branchName=master)
22

3-
Example of a production grade entity service storing information in PostgreSQL. With Swagger-UI and configuration profiles.
4-
*Libpq is used to communicate with PostgreSQL database.*
5-
*Dockerfile and docker-compose.yaml files included.*
3+
A complete example of a "CRUD" service (UserService) built with Oat++ and using oatpp ORM with PostgreSQL.
64

7-
See more:
5+
6+
In this example:
7+
8+
- How to create CRUD endpoints.
9+
- How to use [oatpp ORM](https://oatpp.io/docs/components/orm/) - PostgreSQL example.
10+
- How to document API with Swagger-UI and OpenApi 3.0.0.
11+
12+
More about Oat++:
813

914
- [Oat++ Website](https://oatpp.io/)
1015
- [Oat++ Github Repository](https://github.com/oatpp/oatpp)
1116
- [Get Started](https://oatpp.io/docs/start)
1217

1318
## Overview
1419

15-
This project is using [oatpp](https://github.com/oatpp/oatpp) and [oatpp-swagger](https://github.com/oatpp/oatpp-swagger) modules.
20+
This project is using the following oatpp modules:
21+
22+
- [oatpp](https://github.com/oatpp/oatpp)
23+
- [oatpp-swagger](https://github.com/oatpp/oatpp-swagger)
24+
- [oatpp-postgresql](https://github.com/oatpp/oatpp-postgresql)
1625

1726
### Project layout
1827

@@ -21,11 +30,13 @@ This project is using [oatpp](https://github.com/oatpp/oatpp) and [oatpp-swagger
2130
|- src/
2231
| |
2332
| |- controller/ // Folder containing Controller where all endpoints are declared
24-
| |- db/ // Database class is here
33+
| |- db/ // Folder containing the database client
2534
| |- dto/ // DTOs are declared here
35+
| |- service/ // Service business logic classes (UserService)
2636
| |- ServiceComponent.hpp // Service configuration (port, ObjectMapper, Database)
2737
| |- SwaggerComponent.hpp // Configuration for swagger-ui
2838
| |- AppComponent.hpp // Service configuration is loaded here
39+
| |- DatabaseComponent.hpp // Database config
2940
| |- App.cpp // main() is here
3041
|
3142
|- test/ // test folder
@@ -43,12 +54,12 @@ This project is using [oatpp](https://github.com/oatpp/oatpp) and [oatpp-swagger
4354

4455
**Requires**
4556

46-
- libpq installed. To install libpq:
47-
- On Mac `$ brew install libpq`
57+
- This example also requires the PostgreSQL package installed.
4858
- On Alpine `$ apk add postgresql-dev`
49-
- On Ubuntu - goto [Install PostgreSQL Client From Sources](#install-postgresql-client-from-sources)
59+
- On Ubuntu `$ apt-get install postgresql-server-dev-all`
5060

51-
- `oatpp` and `oatpp-swagger` modules installed. You may run `utility/install-oatpp-modules.sh`
61+
For more info see [oatpp-postgresql/README.md](https://github.com/oatpp/oatpp-postgresql/blob/master/README.md)
62+
- `oatpp`, `oatpp-swagger` and `oatpp-postgresql` modules installed. You may run `utility/install-oatpp-modules.sh`
5263
script to install required oatpp modules.
5364

5465
```
@@ -81,29 +92,3 @@ $ docker-compose up
8192

8293
Go to [http://localhost:8000/swagger/ui](http://localhost:8000/swagger/ui) to try endpoints.
8394

84-
## Install PostgreSQL Client From Sources
85-
86-
- Download sources from [https://www.postgresql.org/ftp/source/](https://www.postgresql.org/ftp/source/)
87-
```
88-
$ wget https://ftp.postgresql.org/pub/source/v11.1/postgresql-11.1.tar.gz
89-
```
90-
91-
- Untar
92-
```
93-
$ tar -xvzf postgresql-11.1.tar.gz
94-
```
95-
96-
- CD to postgresql-11.1, configure, make:
97-
```
98-
$ cd postgresql-11.1
99-
$ ./configure
100-
$ make
101-
```
102-
- Install PostgreSQL client-only
103-
*For this particular example we don't need full PostgreSQL installation.*
104-
```
105-
$ make -C src/include install
106-
$ make -C src/interfaces install
107-
```
108-
109-
For more information see [PostgreSQL installation guide](https://www.postgresql.org/docs/11/install-procedure.html#INSTALL)

0 commit comments

Comments
 (0)