Build Restful CRUD API for a blog using Ktor, Postgresql, JWT, Exposed, Koin
1. Clone the application
git clone https://github.com/vlad-bstrv/HairBookBackend.git
2. Change postgres url, username and password as per your installation
- open
src/main/kotlin/com/vladbstrv/plugins/Databases.kt
- change
bdUrl
,bdUser
anddbPassword
4. Run the app
The app will start running at http://0.0.0.0:8080
The app defines following CRUD APIs.
Method | Url | Decription | Sample Valid Request Body |
---|---|---|---|
POST | /api/v1/signup | Sign up | JSON |
POST | /api/v1/signin | Log in | JSON |
GET | /api/v1/user | User info |
Method | Url | Description | Sample Valid Request Body |
---|---|---|---|
POST | /api/v1/service | JSON | |
GET | /api/v1/service | Get all services | |
GET | /api/v1/service/{id} | Get service by id | |
PUT | /api/v1/service | Update service | JSON |
DELETE | /api/v1/service/{id} | Delete service |
Method | Url | Description | Sample Valid Request Body |
---|---|---|---|
POST | /api/v1/client | JSON | |
GET | /api/v1/client | Get all clients | |
GET | /api/v1/client/{phoneNumber} | Get service by phoneNumber | |
PUT | /api/v1/client | Update clients | JSON |
DELETE | /api/v1/client/{id} | Delete clients |
Method | Url | Description | Sample Valid Request Body |
---|---|---|---|
POST | /api/v1/working-day | JSON | |
GET | /api/v1/working-day | Get all working-day | |
GET | /api/v1/working-day/{id} | Get working-day by id | |
PUT | /api/v1/working-day | Update working-day | JSON |
DELETE | /api/v1/working-day/{id} | Delete working-day |
Method | Url | Description | Sample Valid Request Body |
---|---|---|---|
POST | /api/v1/appointment | JSON | |
GET | /api/v1/appointment | Get all appointment | |
GET | /api/v1/appointment/{id} | Get appointment by id | |
PUT | /api/v1/appointment | Update appointment | JSON |
DELETE | /api/v1/appointment/{id} | Delete appointment |
{
"email": "mail@gmail.com",
"login": "IvanIvanov",
"password": "123",
"firstName": "Ivan",
"lastName": "Ivanov",
"role": "admin"
}
{
"email": "mail@gmail.com",
"password": "123"
}
{
"name": "Классическая модельная стрижка",
"price": 2000.0,
"time": "01:00:00"
}
{
"id": 1,
"name": "Классическая модельная стрижка",
"price": 2000.0,
"time": "01:00:00"
}
{
"firstName": "Petr",
"lastName": "Petrov",
"phoneNumber": "89113334455",
"comment": ""
}
{
"firstName": "Petr",
"lastName": "Petrov",
"phoneNumber": "89113334455",
"comment": ""
}
{
"date": "2024-01-07",
"startTime": "12:00:00",
"endTime": "19:00:00"
}
{
"id": 1,
"date": "2024-01-07",
"startTime": "12:00:00",
"endTime": "19:00:00"
}
{
"workingDayId": 1,
"servicesId": [
1,
2
],
"startTime": "13:00:00"
}
{
"id": 13,
"workingDayId": 1,
"servicesId": [
1,
2
],
"startTime": "13:00:00"
}