22
33Here lays a Kotlin web project with Ktor framework, Postgres database, and JWT Authentication.
44
5- The project comprises following ingredients:
5+ The project comprises the following ingredients:
66
77- [ Ktor] ( https://ktor.io/ ) server
88 includes [ JSON serializers] ( https://ktor.io/docs/serialization.html ) , [ Authentication] ( https://ktor.io/docs/authentication.html ) ,
@@ -12,12 +12,12 @@ The project comprises following ingredients:
1212- [ Exposed] ( https://github.com/JetBrains/Exposed ) as ORM
1313- [ Hikari Connection Pool] ( https://github.com/brettwooldridge/HikariCP )
1414- [ Logback] ( https://logback.qos.ch/ ) for logging purposes
15- - [ JBCrypt] ( https://www.mindrot.org/projects/jBCrypt/ ) for hashing passwords(No salting yet)
15+ - [ JBCrypt] ( https://www.mindrot.org/projects/jBCrypt/ ) for hashing passwords (No salting yet)
1616
17- There is a simple implementation of Graph search and traverse with DFS algorithm but if you aim for a solid solution
17+ There is a simple implementation of DFS algorithm, but if you aim for a solid solution,
1818better go for [ GUAVA Graph] ( https://github.com/google/guava/wiki/GraphsExplained ) from Google.
1919
20- Project is agnostic about database, you can dynamically change Postgres to any other databases that Exposed JDBC
20+ Project is SQL DB agnostic. You are able to dynamically change Postgres to any other databases that Exposed JDBC
2121supports by changing a couple of variables:
2222
2323- the database driver version in ` gradle.properties `
@@ -27,21 +27,20 @@ supports by changing a couple of variables:
2727## Flow
2828
29291 . deploy the docker compose with ` docker compose up -d ` command
30- 2 . sign up to the system ` /signup ` with a username and password(not hardened enough)
31- 3 . log in to with username and password to get access token ` /login `
32- 4 . send post request with payload and token to ` /hirearchy ` to create the hierarchy of the organization
30+ 2 . sign up to ` /signup ` route providing a username and password(not hardened enough)
31+ 3 . log in to with your username and password to get access token ` /login `
32+ 4 . send ` POST ` request with payload and token to ` /hirearchy ` to create the hierarchy of the organization
33335 . send get request with token to ` /hierarchy/{name}/supervisors ` to fetch the supervisors of the current user
3434
3535## How to use
3636
3737> You need ** root access** for docker
3838
3939Go to the root directory of the project where ` docker-compose.yml ` is and change the environment variables in
40- ` .env-example ` with yours and rename the file to ` mv .env-example .env ` then deploy the application with following
41- command:
40+ ` .env-example ` with yours and rename the file to ` .env ` then deploy the application with the following command:
4241
4342``` bash
44- docker-compose up
43+ docker-compose up -d
4544```
4645
4746for shutting down the deployment run following command where the ` docker-compose.yml ` file resides:
@@ -75,8 +74,8 @@ curl --request POST -sLv \
7574
7675```
7776
78- The response to querying the endpoint where the root is at the top of the JSON nested dictionary. For instance, previous
79- input would result in:
77+ The response to querying the endpoint where the root is at the top of the JSON nested dictionary.
78+ For instance, previous input would result in:
8079
8180``` bash
8281curl --request GET -sLv \
@@ -121,7 +120,7 @@ the response of the query will be:
121120}
122121```
123122
124- Sophie is the supervisor of the Nick and Jonas is supervisor of the supervisor of the Nick
123+ Sophie is the supervisor of the Nick, and Jonas is a supervisor of the supervisor of the Nick
125124
126125## It's secured by JWT authentication
127126
@@ -151,22 +150,22 @@ The response will be the access token
151150}
152151```
153152
154- ## How to test locally
153+ ## How to run tests locally
155154
156- For testing the project locally you can run docker compose with ` docker-compose-test.yml ` file. It will run the tests
157- against a test database.
155+ To run the tests locally, you should run docker compose with ` docker-compose-test.yml ` file.
156+ It will run the tests against the test database.
158157
159158``` bash
160159docker-compose --file docker-compose-test.yml up
161160```
162161
163- After finishing the tests you can clean test data nd shut the containers down with following command:
162+ After finishing the tests, you can clean test data nd shut the containers down with the following command:
164163
165164``` bash
166165docker-compose --file docker-compose-test.yml down -v
167166```
168167
169168## Continues Integration
170169
171- For continues integration, the CI workflow prepares the database, run the gradle build with tests, and generates report
172- to Codacy about the quality of code .
170+ CI workflow prepares the database, runs the Gradle build with tests,
171+ and generates a good quality report to [ Codacy ] ( https://www.codacy.com/ ) .
0 commit comments