-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
45 lines (36 loc) · 889 Bytes
/
main.go
File metadata and controls
45 lines (36 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"log"
"os"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/recover"
"github.com/corenzy/domainvalidator/handlers"
)
func main() {
app := fiber.New(fiber.Config{
AppName: "Domain Validator API",
})
// Middleware
app.Use(logger.New())
app.Use(recover.New())
app.Use(cors.New())
// Routes
app.Get("/", func(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"name": "Domain Validator API",
"version": "1.0.0",
"author": "CorenzyTeam <contact@nego.one>"
"lib": "com.corenzy.domainvalidator"
})
})
app.Post("/lookup", handlers.HandleLookup)
// Port
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
log.Printf("🚀 Domain Validator API running on :%s", port)
log.Fatal(app.Listen(":" + port))
}