Skip to content

Commit

Permalink
chore(docs): change readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
khiem20tc committed Sep 19, 2024
1 parent be0f2a9 commit 55ad000
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 48 deletions.
22 changes: 14 additions & 8 deletions README.md
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

Expand All @@ -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:
Expand All @@ -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.
2 changes: 1 addition & 1 deletion dto/user.dto.go
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"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module botp-gateway
module fiber-gateway

go 1.21

Expand Down
4 changes: 2 additions & 2 deletions gorm/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"log"

config "botp-gateway/config"
model "botp-gateway/model"
config "fiber-gateway/config"
model "fiber-gateway/model"

"gorm.io/driver/postgres"
"gorm.io/gorm"
Expand Down
10 changes: 5 additions & 5 deletions main.go
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]

Expand Down
4 changes: 2 additions & 2 deletions middleware/auth.middleware.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package middleware

import (
"botp-gateway/model"
jsonWebToken "botp-gateway/utils/jwt"
"fiber-gateway/model"
jsonWebToken "fiber-gateway/utils/jwt"
"slices"

"github.com/gofiber/fiber/v2"
Expand Down
2 changes: 1 addition & 1 deletion middleware/rateLimit/rateLimit.middleware.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package rateLimitMiddleware

import (
"botp-gateway/validator"
"fiber-gateway/validator"
"time"

"github.com/gofiber/fiber/v2"
Expand Down
4 changes: 2 additions & 2 deletions router/router.go
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)
}
}
2 changes: 1 addition & 1 deletion router/user/user.router.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package userRouter

import (
userService "botp-gateway/service/user"
userService "fiber-gateway/service/user"

"github.com/gofiber/fiber/v2"
)
Expand Down
14 changes: 7 additions & 7 deletions scripts/gen-swagger/main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package main

import (
"botp-gateway/scripts/gen-swagger/types"
commonUtil "botp-gateway/scripts/gen-swagger/utils/common"
convertType "botp-gateway/scripts/gen-swagger/utils/convert-type"
deftSourceUtil "botp-gateway/scripts/gen-swagger/utils/deft-source"
fileUtil "botp-gateway/scripts/gen-swagger/utils/file"
genCommentUtil "botp-gateway/scripts/gen-swagger/utils/gen-comment"
sourceDataUtil "botp-gateway/scripts/gen-swagger/utils/source-data"
"fiber-gateway/scripts/gen-swagger/types"
commonUtil "fiber-gateway/scripts/gen-swagger/utils/common"
convertType "fiber-gateway/scripts/gen-swagger/utils/convert-type"
deftSourceUtil "fiber-gateway/scripts/gen-swagger/utils/deft-source"
fileUtil "fiber-gateway/scripts/gen-swagger/utils/file"
genCommentUtil "fiber-gateway/scripts/gen-swagger/utils/gen-comment"
sourceDataUtil "fiber-gateway/scripts/gen-swagger/utils/source-data"
"fmt"
"go/ast"
"go/format"
Expand Down
4 changes: 2 additions & 2 deletions scripts/gen-swagger/types/common.types.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package types

import (
convertTypeUtil "botp-gateway/scripts/gen-swagger/utils/convert-type"
sourceDataUtil "botp-gateway/scripts/gen-swagger/utils/source-data"
convertTypeUtil "fiber-gateway/scripts/gen-swagger/utils/convert-type"
sourceDataUtil "fiber-gateway/scripts/gen-swagger/utils/source-data"
"go/ast"
)

Expand Down
6 changes: 3 additions & 3 deletions scripts/gen-swagger/utils/convert-type/convert-type.util.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package convertTypeUtil

import (
commonUtil "botp-gateway/scripts/gen-swagger/utils/common"
deftSourceUtil "botp-gateway/scripts/gen-swagger/utils/deft-source"
sourceDataUtil "botp-gateway/scripts/gen-swagger/utils/source-data"
commonUtil "fiber-gateway/scripts/gen-swagger/utils/common"
deftSourceUtil "fiber-gateway/scripts/gen-swagger/utils/deft-source"
sourceDataUtil "fiber-gateway/scripts/gen-swagger/utils/source-data"
"fmt"
"go/ast"
"reflect"
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen-swagger/utils/file/file.util.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package fileUtil

import (
"botp-gateway/scripts/gen-swagger/types"
"fiber-gateway/scripts/gen-swagger/types"
"fmt"
"go/ast"
"go/parser"
Expand Down
8 changes: 4 additions & 4 deletions scripts/gen-swagger/utils/gen-comment/gen-comment.util.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package genCommentUtil

import (
"botp-gateway/scripts/gen-swagger/types"
commonUtil "botp-gateway/scripts/gen-swagger/utils/common"
convertTypeUtil "botp-gateway/scripts/gen-swagger/utils/convert-type"
sourceDataUtil "botp-gateway/scripts/gen-swagger/utils/source-data"
"fiber-gateway/scripts/gen-swagger/types"
commonUtil "fiber-gateway/scripts/gen-swagger/utils/common"
convertTypeUtil "fiber-gateway/scripts/gen-swagger/utils/convert-type"
sourceDataUtil "fiber-gateway/scripts/gen-swagger/utils/source-data"
"fmt"
"sort"

Expand Down
4 changes: 2 additions & 2 deletions service/user/user.service.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package userService

import (
"botp-gateway/gorm"
"botp-gateway/model"
"fiber-gateway/gorm"
"fiber-gateway/model"

"github.com/gofiber/fiber/v2"
)
Expand Down
2 changes: 1 addition & 1 deletion utils/aes/aes.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package aes

import (
"botp-gateway/config"
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"errors"
"fiber-gateway/config"
"io"
)

Expand Down
6 changes: 3 additions & 3 deletions utils/jwt/jwt.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package jsonWebToken

import (
"botp-gateway/config"
"botp-gateway/model"
"fiber-gateway/config"
"fiber-gateway/model"
"time"

jwt "github.com/golang-jwt/jwt/v5"

redis "botp-gateway/utils/redis"
redis "fiber-gateway/utils/redis"
)

var timeExpiredTokenEmail = time.Minute * 15
Expand Down
2 changes: 1 addition & 1 deletion utils/totp/totp.go
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"

Expand Down
2 changes: 1 addition & 1 deletion validator/register-custom-validator.go
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"
Expand Down

0 comments on commit 55ad000

Please sign in to comment.