Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastianmahecha/teravision
This project is a practice API. I'm using Go + Gin + Gorm and PostgreSQL
https://github.com/sebastianmahecha/teravision
gin golang gorm postgresql
Last synced: about 17 hours ago
JSON representation
This project is a practice API. I'm using Go + Gin + Gorm and PostgreSQL
- Host: GitHub
- URL: https://github.com/sebastianmahecha/teravision
- Owner: SebastianMahecha
- Created: 2019-11-19T23:49:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-20T07:49:35.000Z (about 5 years ago)
- Last Synced: 2024-11-14T18:17:00.512Z (2 months ago)
- Topics: gin, golang, gorm, postgresql
- Language: Go
- Homepage:
- Size: 7.7 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TeraVision Test
## Steps to install the project
1. Install go and configure GOPATH and GOROOT environment variables \
`https://golang.org/doc/install`
2. Create folder \
`{{project_name}}/src/github.com`
3. Clone repository \
If you have ssh key in your PC `[email protected]:SebastianMahecha/teravision.git` \
Else `https://github.com/SebastianMahecha/teravision.git`
4. If you do not have a database in the cloud for testing, then create a postgres database in your local. Skip the first two commands if you already have postgres installed. \
`sudo apt-get update` \
`sudo apt-get install postgresql postgresql-contrib` v
`sudo -u postgres psql` \
`CREATE USER teravision_user WITH PASSWORD 'fDG6k6nAb#YG';` \
`CREATE DATABASE teravision_db;` \
`GRANT ALL PRIVILEGES ON DATABASE "teravision_db" to teravision_user;` \
`\q`
5. Configure your local or remote database access in file: \
`./config/config.env`### Normal way to run the project
1. Install dependencies \
`go get -u -v github.com/gin-gonic/gin` \
`go get -u -v github.com/jinzhu/gorm` \
`go get -u -v github.com/jinzhu/gorm/dialects/postgres` \
`go get -u -v github.com/lib/pq`
2. Run project \
`go run application.go`### Run the project with Docker
1. Update docker-compose \
`docker-compose up`
2. Run project \
`docker-compose run teravision`### If the service is already running, then try the api.
1. Import the following collection into PostMan: \
`teravision.postman_collection.json`
2. Parameterize the {{domain}} variable of your collection. Example: \
Request \
`http://127.0.0.1:3000/api/v1/user` \
`{
"name": "Juan Sebastian Mahecha Macias",
"fiscal_number": "10706541587",
"birthdate": "1996-12-29"
}`
Error Response - Http Status 400 \
`{
"data": {
"error_code": "general_error",
"message": "User not saved successfully. Error: User already exists."
},
"status": "error"
}` \
Success Response - Http Status 200 \
`{
"data": {
"message": "User saved successfully"
},
"status": "success"
}`3. Modify the json of the body and send several requests
### Send me your feedback, please