This CSR backend API.
GET /api/docs
- swagger generated UI
Checked from unix-compatible OS. Go 1.22.5 is the current version.
- Install all necessary tools
make setup
- Generate necessary go files (related to ent, swagger)
make generate
- Run database
make db
- Run the service:
The server is here - http://127.0.0.1:8080/api Swagger docs are here - http://127.0.0.1:8080/api/docs
make run
- Service cURL request example:
curl -XPOST http://127.0.0.1:8080/api/v1/users/ -vvv * Trying 127.0.0.1:8080... * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > POST /api/v1/users/ HTTP/1.1 > Host: 127.0.0.1:8080 > User-Agent: curl/7.77.0 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 201 Created < Content-Type: application/json < Date: Tue, 15 Feb 2022 10:16:36 GMT < Content-Length: 20 < Connection: close < {"data":{"id":"1"}}
Before starting, you need to install git (https://git-scm.com/downloads) and docker (https://docs.docker.com/desktop/install/windows-install/) 0. Change in config.json db host to
"host": "postgres",
- Run the build container (pull updates and build):
make rebuild_project
- Run the build container:
make start_project
To draw entities relationships diagram:
go get -u github.com/a8m/enter
enter ./ent/schema
Files are stored in the file system. The name of the folder with files is set in environment variable PHOTOS_FOLDER. The database stores id - names of files without an extension