Skip to content

Commit

Permalink
chore: add logger and cors
Browse files Browse the repository at this point in the history
Signed-off-by: Hemanth Krishna <hkpdev008@gmail.com>
  • Loading branch information
DarthBenro008 committed Apr 7, 2023
1 parent 50b15f8 commit a3198f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions handlers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"github.com/google/uuid"
"io"
"os/exec"
Expand All @@ -13,6 +14,7 @@ func deployer(repo Repository) (string, error) {
}

func executor(uuid string, repo Repository) error {
fmt.Println("executor initiating")
cmd := exec.Command(SCRIPT)
stderr, err := cmd.StderrPipe()
stdout, err := cmd.StdoutPipe()
Expand All @@ -30,6 +32,7 @@ func executor(uuid string, repo Repository) error {
StdErr: errors,
Time: time.Now().String(),
}
fmt.Println(results)
err = repo.InsertDeployment(d)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"github.com/genjidb/genji"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/logger"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -35,6 +37,8 @@ func initDb() *genji.DB {

func runRestServer(repo Repository) {
app := fiber.New()
app.Use(cors.New())
app.Use(logger.New())

app.Get("/", func(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
Expand Down

0 comments on commit a3198f3

Please sign in to comment.