2021-05-02 07:49:13 +00:00
|
|
|
# Jokes Bapak2 API
|
|
|
|
|
|
|
|
Still work in progress
|
|
|
|
|
2021-05-02 07:58:37 +00:00
|
|
|
## Development
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Install modules
|
2021-07-09 12:13:19 +00:00
|
|
|
$ go mod download
|
2021-05-02 07:58:37 +00:00
|
|
|
# or
|
|
|
|
$ go mod vendor
|
|
|
|
|
|
|
|
# run the local server
|
2021-07-09 12:13:19 +00:00
|
|
|
$ go run main.go
|
2021-05-02 07:58:37 +00:00
|
|
|
|
|
|
|
# build everything
|
2021-07-09 12:13:19 +00:00
|
|
|
$ go build main.go
|
2021-05-02 07:58:37 +00:00
|
|
|
```
|
2021-05-02 07:49:13 +00:00
|
|
|
|
2021-07-09 12:13:19 +00:00
|
|
|
## Used packages
|
2021-05-02 07:49:13 +00:00
|
|
|
|
2021-07-09 12:13:19 +00:00
|
|
|
| Name | Version | Type |
|
|
|
|
| --- | --- | --- |
|
2021-07-09 12:22:56 +00:00
|
|
|
| [gofiber/fiber](https://github.com/gofiber/fiber) | `v2.14.0` | Framework |
|
|
|
|
| [jackc/pgx](https://github.com/jackc/pgx) | `v4.11.0` | Database |
|
|
|
|
| [go-redis/redis](https://github.com/go-redis/redis) | `v8.11.0` | Cache |
|
|
|
|
| [joho/godotenv](https://github.com/joho/godotenv) | `v1.3.0` | Config |
|
|
|
|
| [getsentry/sentry-go](https://github.com/getsentry/sentry-go) | `v0.11.0` | Logging |
|
|
|
|
| [aldy505/phc-crypto](https://github.com/aldy505/phc-crypto) | `v1.1.0` | Utils |
|
|
|
|
| [Masterminds/squirrel](https://github.com/Masterminds/squirrel ) | `v1.5.0` | Utils |
|
|
|
|
| [aldy505/bob](https://github.com/aldy505/bob) | `v0.0.1` | Utils |
|
2021-07-09 12:13:19 +00:00
|
|
|
|
|
|
|
## Directory structure
|
|
|
|
|
|
|
|
```
|
|
|
|
└-- /app
|
|
|
|
└---- /v1
|
|
|
|
└---- /handler
|
|
|
|
└---- /middleware folder for add middleware
|
|
|
|
└---- /models
|
|
|
|
└---- /platform
|
|
|
|
└--------- /cache folder with in-memory cache setup functions
|
|
|
|
└--------- /database folder with database setup functions
|
|
|
|
└---- /routes folder for describe routes
|
|
|
|
└---- /utils folder with utility functions
|
|
|
|
```
|
|
|
|
## `.env` configuration
|
|
|
|
|
|
|
|
```ini
|
|
|
|
ENV=development
|
|
|
|
PORT=5000
|
|
|
|
|
|
|
|
DATABASE_URL=postgres://postgres:password@localhost:5432/jokesbapak2
|
|
|
|
REDIS_URL=redis://@localhost:6379
|
|
|
|
|
|
|
|
SENTRY_DSN=
|
|
|
|
```
|