Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Mapping in controllers #87

@nicola-spb

Description

@nicola-spb

All public methods in controllers are mapped to url path by default.

Maybe will be better if only methods with suffix or prefix "Action" will mapped by default. Some people can`t knew that their methods open for public.

Example:

// this will be parsed to /todo/home by default. Method for routing
func (t *Todo) ActionHome() {
	todos := []models.Todo{}
	....
	t.HTML(http.StatusOK)
}

// this won`t be parsed by default. Simple public method
func (t *Todo) Home2() {
	todos := []models.Todo{}
	....
	t.HTML(http.StatusOK)
}

if user want to set path manual then he can set

func NewTodo() controller.Controller {
	return &Todo{
		Routes: []string{
			"get;/;Home",			
		},
	}
}

Or maybe add some flexible settings for do it.

default parsing here https://github.com/gernest/utron/blob/master/router/routes.go#L230

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions