-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.go
39 lines (28 loc) · 764 Bytes
/
server.go
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
package main
import (
"log"
"net/http"
"spamtrawler/app"
"spamtrawler/app/routes"
"github.com/labstack/echo/middleware"
"github.com/labstack/echo"
)
func main() {
// Enable line numbers in logging
log.SetFlags(log.LstdFlags | log.Lshortfile)
// Will print: "[date] [time] [filename]:[line]: [text]"
//log.Println("Logging w/ line numbers on golangcode.com")
// Echo instance
e := echo.New()
// Middleware
//e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*"},
AllowMethods: []string{http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete},
}))
app.Start()
routes.RouteHandler(e)
// Start server
e.Logger.Fatal(e.Start(":1232"))
}