You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,12 @@
1
1
# Kotlin Ktor and postgres backend
2
+
2
3
Here lays a Kotlin web project with Ktor framework, Postgres database, and JWT Authentication.
3
4
4
5
The project comprises following ingredients:
5
-
-[Ktor](https://ktor.io/) server includes [JSON serializers](https://ktor.io/docs/serialization.html), [Authentication](https://ktor.io/docs/authentication.html), and [Testing](https://ktor.io/docs/testing.html)
6
+
7
+
-[Ktor](https://ktor.io/) server
8
+
includes [JSON serializers](https://ktor.io/docs/serialization.html), [Authentication](https://ktor.io/docs/authentication.html),
9
+
and [Testing](https://ktor.io/docs/testing.html)
6
10
-[Netty](https://netty.io/) web server
7
11
-[Postgres](https://www.postgresql.org/) as database
8
12
-[Exposed](https://github.com/JetBrains/Exposed) as ORM
@@ -15,11 +19,13 @@ better go for [GUAVA Graph](https://github.com/google/guava/wiki/GraphsExplained
15
19
16
20
Project is agnostic about database, you can dynamically change Postgres to any other databases that Exposed JDBC
17
21
supports by changing a couple of variables:
22
+
18
23
- the database driver version in `gradle.properties`
19
24
- the database driver dependency in `build.gradle.kts`
20
25
- the **WEB_DB_URL** variable in `.env` file
21
26
22
27
## Flow
28
+
23
29
1. deploy the docker compose with `docker compose up -d` command
24
30
2. sign up to the system `/signup` with a username and password(not hardened enough)
25
31
3. log in to with username and password to get access token `/login`
@@ -31,7 +37,8 @@ supports by changing a couple of variables:
31
37
> You need **root access** for docker
32
38
33
39
Go to the root directory of the project where `docker-compose.yml` is and change the environment variables in
34
-
`.env-example` with yours and rename the file to `mv .env-example .env` then deploy the application with following command:
40
+
`.env-example` with yours and rename the file to `mv .env-example .env` then deploy the application with following
41
+
command:
35
42
36
43
```bash
37
44
docker-compose up
@@ -145,17 +152,21 @@ The response will be the access token
145
152
```
146
153
147
154
## How to test locally
155
+
148
156
For testing the project locally you can run docker compose with `docker-compose-test.yml` file. It will run the tests
149
157
against a test database.
158
+
150
159
```bash
151
160
docker-compose --file docker-compose-test.yml up
152
161
```
153
-
After finishing the tests you can clean test data nd shut the containers down with following command:
162
+
163
+
After finishing the tests you can clean test data nd shut the containers down with following command:
154
164
155
165
```bash
156
166
docker-compose --file docker-compose-test.yml down -v
157
167
```
158
168
159
169
## Continues Integration
170
+
160
171
For continues integration, the CI workflow prepares the database, run the gradle build with tests, and generates report
# # Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the PostgreSQL JDBC driver documentation in order to use it.
0 commit comments