Created
January 17, 2020 02:26
-
-
Save manakuro/873969b04feca06d88a494fc4990900b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net/http" | |
"github.com/labstack/echo" | |
"github.com/labstack/echo/middleware" | |
"firebase-authentication-with-react-and-go/backend/datastore" | |
) | |
func main() { | |
db, err := datastore.NewDB() | |
logFatal(err) | |
db.LogMode(true) | |
defer db.Close() | |
e := echo.New() | |
e.Use(middleware.Logger()) | |
e.Use(middleware.Recover()) | |
e.GET("/", func(c echo.Context) error { | |
return c.String(http.StatusOK, "Welcome!") | |
}) | |
err = e.Start(":8080") | |
logFatal(err) | |
} | |
func logFatal(err error) { | |
if err != nil { | |
log.Fatalln(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment