https://github.com/lucasvmiguel/go-api-test
REST API in Golang to practice
https://github.com/lucasvmiguel/go-api-test
chi golang prisma rest-api
Last synced: 10 months ago
JSON representation
REST API in Golang to practice
- Host: GitHub
- URL: https://github.com/lucasvmiguel/go-api-test
- Owner: lucasvmiguel
- Created: 2021-09-29T21:27:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-01T12:08:17.000Z (over 4 years ago)
- Last Synced: 2024-06-21T17:06:00.484Z (over 1 year ago)
- Topics: chi, golang, prisma, rest-api
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-api-test
REST API in Golang to practice.
## Install
```
git clone git@github.com:lucasvmiguel/go-api-test.git
```
*You must have Golang installed and configured to work with this API.*
## Getting Started
First, generate the database schema and Golang ORM code:
```
make db-migrate
make db-generate
```
Then, run the development server:
```bash
make run-api
```
## Stack
* Language: `Golang`
* API/REST framework: `chi`
* Database ORM: `Prisma`
* Config reader: `godotenv`
## Testing
### How to run unit
```
make test-unit
```
## Configuration
All config are passed using environment variables, see all them below:
Env Var | Default value |
--- | --- |
`PORT` | 8080 |
## Folder/File struct
* `/db`: All ORM entities are auto generated using prisma.
* `/cmd`: Main applications for this project.
* `/internal`: Private application and library code.
* `/pkg`: Library code that's ok to use by external applications.
* `/.github`: CI/CD from Github.
* `schema.prisma`: Database schema.
* `dev.db`: Database used for development.
* `Makefile`: Project's executable tasks.
*Reference: https://github.com/golang-standards/project-layout*
## CI/CD
Check the Github actions for this repository, but in a nutshell:
1. Set up Go
2. Build
3. Test
4. Log in to the Container registry (Github)
5. Build and push Docker images