-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
54 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# BOTP Gateway | ||
# Fiber Gateway | ||
|
||
![Golang](https://img.shields.io/badge/language-Golang-blue.svg) | ||
|
||
The BOTP Gateway is a GoLang-based project designed to serve as a versatile gateway for various API management | ||
The Fiber Gateway is a GoLang-based project designed to serve as a versatile gateway for various API management | ||
|
||
## Features | ||
|
||
|
@@ -16,15 +16,16 @@ The BOTP Gateway is a GoLang-based project designed to serve as a versatile gate | |
|
||
### Prerequisites | ||
|
||
Before you can run the BOTP Gateway, ensure you have the following prerequisites installed: | ||
Before you can run the Fiber Gateway, ensure you have the following prerequisites installed: | ||
|
||
- [Go](https://golang.org/dl/): Make sure you have Go installed on your system. | ||
|
||
### Installation | ||
|
||
1. Clone the repository to your local machine: | ||
|
||
```bash | ||
git clone [email protected]:B-K-Labs/BOTP-Gateway.git | ||
git clone [email protected]:khiem20tc/go-fiber-gorm-boilerplate.git | ||
``` | ||
|
||
2. Create a `.env` file and define the necessary environment variables. These variables will be used for configuration. Example: | ||
|
@@ -34,36 +35,41 @@ DATABASE_URL="localhost:5432" | |
``` | ||
|
||
3. Download and install packages | ||
|
||
```bash | ||
go mod download && go mod tidy | ||
``` | ||
|
||
4. Run the BOTP Gateway using the following command: | ||
4. Run the Fiber Gateway using the following command: | ||
|
||
```bash | ||
go run main.go | ||
``` | ||
|
||
or | ||
or | ||
|
||
```bash | ||
nodemon --watch './**/*.go' --signal SIGTERM --exec 'go' run ./main.go | ||
``` | ||
|
||
5. Run Lint-stage for Golang | ||
|
||
```bash | ||
golangci-lint run | ||
golangci-lint run | ||
``` | ||
|
||
5. Gen swagger API document using the following command: | ||
|
||
```bash | ||
go run ./scripts/gen-swagger/main.go && go run ./scripts/swag/main.go init --ot go,json --parseDependency true | ||
``` | ||
|
||
6. Build docker container | ||
|
||
```bash | ||
docker-compose up -d --force-recreate | ||
``` | ||
|
||
## Usage | ||
|
||
Once the BOTP Gateway is up and running, you can start sending API requests to it, and it will handle load balancing, rate limiting, and forwarding based on the configuration. | ||
Once the Fiber Gateway is up and running, you can start sending API requests to it, and it will handle load balancing, rate limiting, and forwarding based on the configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package dto | ||
|
||
import ( | ||
"botp-gateway/model" | ||
"fiber-gateway/model" | ||
"time" | ||
|
||
"github.com/dranikpg/dto-mapper" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module botp-gateway | ||
module fiber-gateway | ||
|
||
go 1.21 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
package main | ||
|
||
import ( | ||
"botp-gateway/config" | ||
"botp-gateway/router" | ||
"fiber-gateway/config" | ||
"fiber-gateway/router" | ||
|
||
"github.com/gofiber/fiber/v2" | ||
"github.com/gofiber/fiber/v2/middleware/logger" | ||
"github.com/gofiber/fiber/v2/middleware/monitor" | ||
"github.com/gofiber/swagger" | ||
) | ||
|
||
// @title BOTP Gateway API | ||
// @title Fiber Gateway API | ||
// @version 1.0 | ||
// @description Documentation for BOTP Gateway API | ||
// @description Documentation for Fiber Gateway API | ||
// @termsOfService http://swagger.io/terms/ | ||
|
||
// @contact.name BOTP Gateway Support | ||
// @contact.name Fiber Gateway Support | ||
// @contact.url http://www.swagger.io/support | ||
// @contact.email [email protected] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package router | ||
|
||
import ( | ||
userRouter "botp-gateway/router/user" | ||
userRouter "fiber-gateway/router/user" | ||
|
||
"github.com/gofiber/fiber/v2" | ||
) | ||
|
||
func New(app *fiber.App) { | ||
userRouter.CreateRouter(app) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package totp | ||
|
||
import ( | ||
"botp-gateway/config" | ||
"encoding/base32" | ||
"fiber-gateway/config" | ||
"log" | ||
"time" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package validator | ||
|
||
import ( | ||
"botp-gateway/middleware" | ||
"fiber-gateway/middleware" | ||
"reflect" | ||
"regexp" | ||
"strings" | ||
|