Skip to content

Commit a2615cf

Browse files
authored
Update main.go
1 parent 3f31d58 commit a2615cf

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

cmd/api/main.go

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,19 @@ import (
55
"net/http"
66
"os"
77
"strconv"
8-
9-
"github.com/redis/go-redis/v9"
10-
"github.com/go-chi/chi/v5"
11-
"github.com/dash-xd/logma/internal/app"
8+
"github.com/dash-xd/logma2/internal/app"
129
)
1310

14-
func main() {
15-
fmt.Printf("Starting server...\n")
16-
redisClient := redis.NewClient(&redis.Options{
17-
Addr: os.Getenv("REDIS_URI"),
18-
Password: os.Getenv("REDISCLI_AUTH"),
19-
DB: 0,
20-
})
21-
defer redisClient.Close()
22-
entityRegistrar := entity.NewRedisEntityRegistrar(redisClient)
23-
router := app.NewRouter(redisClient, entityRegistrar)
24-
port := getPortFromArgs()
25-
addr := fmt.Sprintf(":%d", port)
26-
fmt.Printf("Go Server is listening on http://localhost%s\n", addr)
27-
if err := http.ListenAndServe(addr, router); err != nil {
28-
panic(err)
29-
}
11+
func main(){
12+
fmt.Printf("starting server ... ")
13+
router := app.NewRouter()
14+
port := getPortFromArgs()
15+
addr := fmt.Sprintf(":%d", port)
16+
fmt.Printf("Go Server is listening on http://localhost%s\n", addr)
17+
err := http.ListenAndServe(addr, router)
18+
if err != nil {
19+
panic(err)
20+
}
3021
}
3122

3223
func getPortFromArgs() int {

0 commit comments

Comments
 (0)