jsonresp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2016 License: MIT Imports: 1 Imported by: 9

README

json-response

JSON wants returned values to be in key-value format. This package removes a couple lines of code I got tired of copypasta-ing between projects.

Dependencies

Installation

go get github.com/jessemillar/jsonresp

Usage

import "github.com/jessemillar/jsonresp"
func SampleFunction(context echo.Context) error {
	err := functionThatReturnsAnError()
	if err != nil {
		return jsonresp.New(context, http.StatusBadRequest, "Could not read request body: "+err.Error())
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c echo.Context, httpStatus int, message string) error

New returns an Echo error message in proper JSON format

Types

This section is empty.

Jump to

Keyboard shortcuts

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