utils

command module
v0.27.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

README

Akkurate utils

Simple http server

package main

import (
	"github.com/Akkurate/utils/apiserver"
	"github.com/Akkurate/utils/logging"
)

// Routes Routes
type Routes struct {
}

func (r *Routes) helloWorld() map[string]string {
	return map[string]string{"hello": "world"}
}
func (r *Routes) RouteIndex(c *apiserver.Context) {
	logging.Info("coming in here")
	a := r.helloWorld()
	a["id"] = c.GetParam("id").AsString()
	c.SendJSON(a)
}

func main() {
	routes := &Routes{}
	routeMapping := map[string]apiserver.RouteHandler{
		"get /:id": routes.RouteIndex,
	}
	server := apiserver.NewAPIServer(&apiserver.APIServerProps{
		Port: "7777",
	})
	server.Start(routeMapping)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Helper functions for handling conversions between types.
Helper functions for handling conversions between types.
Helper functions for handling time.Time objects.
Helper functions for handling time.Time objects.
Logic operations.
Logic operations.
Helper functions for handling floats.
Helper functions for handling floats.
Helper functions for handling integers.
Helper functions for handling integers.
Helper functions for handling strings.
Helper functions for handling strings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL