jokes-bapak2/api/README.md

78 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

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-11-09 03:57:17 +00:00
There is a placeholder data ready for you to query it manually in `/platform/database/placeholder.sql`. Have a good time developing!
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-11-09 03:57:17 +00:00
| [gofiber/fiber](https://github.com/gofiber/fiber) | `v2.21.0` | Framework |
| [jackc/pgx](https://github.com/jackc/pgx) | `v4.13.0` | Database |
| [go-redis/redis](https://github.com/go-redis/redis) | `v8.11.4` | Cache |
| [allegro/bigcache](https://github.com/allegro/bigcache) | `v3.0.1` | Cache |
| [joho/godotenv](https://github.com/joho/godotenv) | `v1.4.0` | Config |
2021-07-09 12:22:56 +00:00
| [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 |
2021-11-09 03:57:17 +00:00
| [Masterminds/squirrel](https://github.com/Masterminds/squirrel ) | `v1.5.1` | Utils |
| [aldy505/bob](https://github.com/aldy505/bob) | `v0.0.4` | Utils |
| [gojek/heimdall](https://github.com/gojek/heimdall) | `v7.0.2` | Utils |
| [georgysavva/scany](https://github.com/georgysavva/scany) | `v0.2.9` | Utils |
2021-11-09 03:57:17 +00:00
| [pquerna/ffjson](https://github.com/pquerna/ffjson) | `v0.0.0-20190930134022-aa0246cd15f7` | Utils |
2021-07-09 12:13:19 +00:00
## Directory structure
```
2021-07-15 12:44:07 +00:00
.
2021-11-09 03:57:17 +00:00
├── core - Pure business logic
│ ├── administrator
│ ├── joke
│ ├── schema
│ ├── submit
│ └── validator
├── Dockerfile - Docker image for API
├── documentation.json - Swagger documentation
├── documentation.yaml - Swagger documentation
├── favicon.png
├── go.mod - Module declaration
├── go.sum - Checksum for modules
├── handler - Route handlers
│ ├── health
│ ├── joke
│ └── submit
├── main.go - Application entry point
├── middleware - Route middlewares
├── platform - Third party packages
│ └── database
├── README.md - You are here
├── routes - Route definitions
└── utils - Utility functions
2021-07-09 12:13:19 +00:00
```
2021-07-15 12:44:07 +00:00
2021-07-09 12:13:19 +00:00
## `.env` configuration
```ini
ENV=development
PORT=5000
DATABASE_URL=postgres://postgres:password@localhost:5432/jokesbapak2
REDIS_URL=redis://@localhost:6379
SENTRY_DSN=
```