generated from OtusGolang/home_work
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Quick start documentation + Postman http collection
- Loading branch information
Showing
2 changed files
with
257 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,40 @@ | ||
#### Результатом выполнения следующих домашних заданий является сервис «Календарь»: | ||
- [Домашнее задание №12 «Заготовка сервиса Календарь»](./docs/12_README.md) | ||
- [Домашнее задание №13 «Внешние API от Календаря»](./docs/13_README.md) | ||
- [Домашнее задание №14 «Кроликизация Календаря»](./docs/14_README.md) | ||
- [Домашнее задание №15 «Докеризация и интеграционное тестирование Календаря»](./docs/15_README.md) | ||
|
||
#### Ветки при выполнении | ||
- `hw12_calendar` (от `master`) -> Merge Request в `master` | ||
- `hw13_calendar` (от `hw12_calendar`) -> Merge Request в `hw12_calendar` (если уже вмержена, то в `master`) | ||
- `hw14_calendar` (от `hw13_calendar`) -> Merge Request в `hw13_calendar` (если уже вмержена, то в `master`) | ||
- `hw15_calendar` (от `hw14_calendar`) -> Merge Request в `hw14_calendar` (если уже вмержена, то в `master`) | ||
|
||
**Домашнее задание не принимается, если не принято ДЗ, предшедствующее ему.** | ||
## Локальный запуск | ||
|
||
Понадобится: | ||
|
||
- golang ~1.21; | ||
- PSQL ~14. | ||
|
||
Используется файл **Makefile** как исходная точка для запуска приложения, серверов и других сопутствующих вещей. | ||
|
||
Заполняем файл конфигурации `configs/config.toml` согласно потребностям. | ||
|
||
| Параметр | Описание | Пример | | ||
|----------- |----------------------------------- |----------------------------------- | | ||
| [logger] | | | | ||
| level | Уровень логирования | DEBUG \| INFO \| WARNING \| ERROR | | ||
| path | Путь к файлу для логирования | "./logs/calendar.log" | | ||
| [storage] | | | | ||
| driver | Драйвер для хранилища | memory \| postgres | | ||
| [db] | | | | ||
| host | Хост для драйвера postgres | "localhost" | | ||
| port | Порт для драйвера postgres | 5432 | | ||
| name | Название БД для драйвера postgres | "otus-db" | | ||
| username | Логин для драйвера postgres | "postgres" | | ||
| password | Пароль для драйвера postgres | "postgres" | | ||
| [http] | | | | ||
| host | Хост для HTTP сервера | "localhost" | | ||
| port | Порт для HTTP сервера | 8080 | | ||
| [grpc] | | | | ||
| host | Хост для GRPC сервера | "localhost" | | ||
|
||
|
||
Для запуска **ВНЕ** Docker выполняем: | ||
|
||
- `make run` | ||
|
||
Результатом выполнения команды будут два сервера Http и Grpc, располженных на портах, согласно файлу конфигурации `configs/config.toml` | ||
|
||
Для тестирования запросов можно использовать коллекцию Postman: [http-collection](docs/postman/OTUS.HTTP.postman_collection.json) | ||
|
||
Для тестирования GRPC-сервера можно воспользоваться функционалом **ServerReflectionInfo** (https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto), который позволит автоматически подгрузить доступные для вызова методы. |
217 changes: 217 additions & 0 deletions
217
hw12_13_14_15_calendar/docs/postman/OTUS.HTTP.postman_collection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
{ | ||
"info": { | ||
"_postman_id": "75a45ad7-ca4e-4612-91ba-db41dd7b3d53", | ||
"name": "HTTP", | ||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | ||
"_exporter_id": "2710404" | ||
}, | ||
"item": [ | ||
{ | ||
"name": "CreateEvent", | ||
"request": { | ||
"method": "POST", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json", | ||
"type": "text" | ||
} | ||
], | ||
"body": { | ||
"mode": "raw", | ||
"raw": "{ \n \"title\": \"occaecat fugiat ut velit dolore\",\n \"date_time\": \"1970-01-01T03:11:23.855081+03:00\",\n \"duration\": 2,\n \"description\": \"consectetur laboris\",\n \"user_id\": 1,\n \"time_notification\": \"1992-11-25T10:29:13.722906+03:00\"\n}," | ||
}, | ||
"url": { | ||
"raw": "localhost:8080/event", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"event" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "UpdateEvent", | ||
"request": { | ||
"method": "PUT", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json", | ||
"type": "text" | ||
} | ||
], | ||
"body": { | ||
"mode": "raw", | ||
"raw": "{ \n \"title\": \"Update title\",\n \"date_time\": \"1970-01-01T03:11:23.855081+03:00\",\n \"duration\": 2,\n \"description\": \"consectetur laboris\",\n \"user_id\": 1,\n \"time_notification\": \"1992-11-25T10:29:13.722906+03:00\"\n}," | ||
}, | ||
"url": { | ||
"raw": "localhost:8080/event/e4d3f1a3-9faa-4bb2-931a-b2d3caed9678", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"event", | ||
"e4d3f1a3-9faa-4bb2-931a-b2d3caed9678" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "DeleteEvent", | ||
"request": { | ||
"method": "DELETE", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json", | ||
"type": "text" | ||
} | ||
], | ||
"body": { | ||
"mode": "raw", | ||
"raw": "{ \n \"title\": \"Update title\",\n \"date_time\": \"1970-01-01T03:11:23.855081+03:00\",\n \"duration\": 2,\n \"description\": \"consectetur laboris\",\n \"user_id\": 1,\n \"time_notification\": \"1992-11-25T10:29:13.722906+03:00\"\n}," | ||
}, | ||
"url": { | ||
"raw": "localhost:8080/event/e4d3f1a3-9faa-4bb2-931a-b2d3caed9678", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"event", | ||
"e4d3f1a3-9faa-4bb2-931a-b2d3caed9678" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "GetEvents", | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "localhost:8080/event", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"event" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "GetEvent", | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "localhost:8080/event/5a51f80c-a76c-4572-8752-955e640edeef", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"event", | ||
"5a51f80c-a76c-4572-8752-955e640edeef" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "GetEventsForDay", | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "localhost:8080/event?type=day&start_date=2023-11-10", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"event" | ||
], | ||
"query": [ | ||
{ | ||
"key": "type", | ||
"value": "day" | ||
}, | ||
{ | ||
"key": "start_date", | ||
"value": "2023-11-10" | ||
} | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "GetEventsForWeek", | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "localhost:8080/event?type=week&start_date=2023-11-10", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"event" | ||
], | ||
"query": [ | ||
{ | ||
"key": "type", | ||
"value": "week" | ||
}, | ||
{ | ||
"key": "start_date", | ||
"value": "2023-11-10" | ||
} | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "GetEventsForMonth", | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "localhost:8080/event?type=month&start_date=2023-11-10", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"event" | ||
], | ||
"query": [ | ||
{ | ||
"key": "type", | ||
"value": "month" | ||
}, | ||
{ | ||
"key": "start_date", | ||
"value": "2023-11-10" | ||
} | ||
] | ||
} | ||
}, | ||
"response": [] | ||
} | ||
] | ||
} |