-
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.
feat(hackathon): add route and struct for upload
- Loading branch information
1 parent
74d611a
commit 4bbb144
Showing
31 changed files
with
1,289 additions
and
101 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,10 +1,12 @@ | ||
# application configuration | ||
# ... this part is optional because config will get default value from env variable | ||
|
||
DB_CONN_STR = "host=127.0.0.1 port=5432 user=dbUser password=dbPassword dbname=application sslmode=disable" | ||
REDIS_HOST = "127.0.0.1:6379" | ||
|
||
# config for expose port from docker container to host | ||
DOCKER_APP_PORT = 80 | ||
DOCKER_DB_PORT = 5432 | ||
DOCKER_REDIS_PORT = 6379 | ||
|
||
# test configuration | ||
TEST_DB_CONN_STR = "host=127.0.0.1 port=5432 user=db.user password=db.password sslmode=disable" | ||
TEST_DB_CONN_STR = "host=127.0.0.1 port=5432 user=dbUser password=dbPassword sslmode=disable" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 +1,7 @@ | ||
package main | ||
|
||
import ( | ||
"elotus/database/migration" | ||
redis2 "elotus/package/redis" | ||
"fmt" | ||
|
||
|
@@ -10,10 +11,26 @@ import ( | |
|
||
"elotus/config" | ||
"elotus/global" | ||
"elotus/internal/v1/interface/http" | ||
"elotus/internal/v1/delivery/http" | ||
"elotus/package/db" | ||
) | ||
|
||
// @title Fiber Swagger Example API | ||
// @version 2.0 | ||
// @description This is a sample server. | ||
// @termsOfService http://swagger.io/terms/ | ||
|
||
// @contact.name API Support | ||
// @contact.url http://www.swagger.io/support | ||
// @contact.email [email protected] | ||
|
||
// @license.name Apache 2.0 | ||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html | ||
|
||
// @securityDefinitions.apikey BearerAuth | ||
// @in header | ||
// @name Authorization | ||
|
||
func main() { | ||
global.Init() | ||
defer global.DeInit() | ||
|
@@ -28,9 +45,17 @@ func main() { | |
panic(err) | ||
} | ||
|
||
// migrate database | ||
migration.CreateTable(database) | ||
|
||
app := fiber.New() | ||
app.Use(cors.New()) | ||
app.Use(requestid.New()) | ||
app.Use(cors.New(cors.Config{ | ||
AllowOrigins: "*", | ||
AllowMethods: "GET, POST, PUT, DELETE", | ||
AllowHeaders: "Origin, Content-Type, Accept, Accept-Language, Content-Length,Authorization", | ||
})) | ||
|
||
http.NewHandler( | ||
http.WithEngine(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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,4 @@ func CreateTable(db *gorm.DB) { | |
|
||
func DropTable(db *gorm.DB) { | ||
db.Migrator().DropTable(&model.User{}) | ||
|
||
} |
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
Oops, something went wrong.