-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
47 lines (33 loc) · 1.23 KB
/
main.go
File metadata and controls
47 lines (33 loc) · 1.23 KB
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
46
47
package main
import (
"log"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"github.com/krishna102001/extract_image_from_pdf/database"
"github.com/krishna102001/extract_image_from_pdf/middleware"
"github.com/krishna102001/extract_image_from_pdf/routes"
)
func init() {
if err := godotenv.Load(); err != nil {
log.Fatal("Failed to intitalized the env file")
}
}
func main() {
var app *gin.Engine = gin.Default()
database.InitializedDB()
app.Use(cors.Default())
app.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{"msg": "Hello Krishna !! Basic setup done"})
})
router := app.Group("/api/v1")
router.POST("/extract-pdf-image", middleware.RateLimiter(), routes.ExtractPDFImageRoutes)
router.GET("/get/extract/:id", middleware.RateLimiter(), routes.GetExtract)
router.POST("/convert-pdf-image", middleware.RateLimiter(), routes.ConvertPDFImageRoutes)
router.GET("/get/convert/:id", middleware.RateLimiter(), routes.GetConvert)
router.POST("/extract-text/image", middleware.RateLimiter(), routes.GetExtractTextImage)
if err := app.Run(":8080"); err != nil {
log.Printf("Failed to run server on port no. : %s", "8080")
}
log.Printf("Server is running on port no. : %s", "8080")
}