figaro

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 0 Imported by: 0

README

Figaro

Build Status Go Report Card Quality Gate Status

Small library to make easy Go

Easy come, easy go, will you let me go?

The library takes its name from a famous song wrote by a famous artist as the goal of those packages is to make "easy go".

Packages

http/response

This package provides helpers designed to help in writing HTTP response. The principle is easy: create a new Response fed with a set of options and inject the http.responseWriter into it to write the response.

package your_package

import (
	"net/http"
	"time"

	"github.com/alexdebril/figaro/http/response"
)

type JsonMessage struct {
    Date    time.Time `json:"date"`
    Message string    `json:"message"`
}

type Handler struct {}

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    message := &JsonMessage{
        Date:    time.Now(),
        Message: "this is the new message",
    }
    resp := response.NewJsonResponse(message)
    resp.Write(w)
}

See ? it's easy.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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