Categorygithub.com/davidgaspardev/gosrv
repositorypackage
0.0.2
Repository: https://github.com/davidgaspardev/gosrv.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Go SRV

Go server or Go SRV is a http server minimal.

Using

package main

import "github.com/davidgaspardev/gosrv.go"

func main() {
    // Create HTTP server
    server := gosrv.NewServer()

    server.AddRoute("GET", "/api/v1/hello/:name", []middleware.Middleware{
        // Print incoming HTTP requests
        middleware.Logger,
    }, HelloWorld)

    server.Run()
}

// Hello World Controller
func HelloWorld(req *helpers.Request, res *helpers.Response) {
    // Get path parameters from request
	name := req.GetParam("name")

	res.Ok("Hello World for you, "+name)
}