Routing | Goffee
Description: All routes are defined in the file routes.go which is located in the root dir, here is an example for defining a route:

Skip to main content

# Routing

All routes are defined in the file `routes.go` which is located in the root dir, here is an example for defining a route:

#file: routes.go

    package main

    import (
    	"git.smarteching.com/goffee/core"
    	"git.smarteching.com/goffee/goffee/controllers"
    )

    // Register the app routes
    func registerRoutes() {
    	router := core.ResolveRouter()
    	//#############################
    	//# App Routes            #####
    	//#############################

    	// Define your routes here...
        controller.Get("/todos", controllers.ListTodos)
    }

Where `controllers.ListTodos` is the handler function that handles the request.

#file: controllers/todos.go

    package controllers

    import (
        "git.smarteching.com/goffee/core"
    )

    func ListTodos(c *core.Context) *core.Response {
        //The logic for listing users
    }

to learn more about `controllers` click here