Implementing a project

With the appropriate structure in place for our Echo project, we can get started by expanding on our simple example Echo application from Chapter 1, Understanding HTTP, Go, and Echo.

The following code is located in the $GOPATH/src/github.com/PacktPublishing/Echo-Essentials/chapter2/cmd/service/main.go file:

package main

import (
        "github.com/PacktPublishing/Echo-Essentials/chapter2/handlers"
        "github.com/labstack/echo"
)

func main() {
        // create a new echo instance
        e := echo.New()
        // Route / to handler function
        e.GET("/health-check", handlers.HealthCheck)        // Authentication routes
        e.POST("/login", handlers.Login)
        e.POST("/logout", handlers.Logout)        // start the server, and log if it fails              e.Logger.Fatal(e.Start(":8080")) ...

Get Echo Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.