jparser

package module
v0.0.0-...-a8fcd00 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2018 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

JPARSER

Parses and beautifies JSON requests

Usage

go run cmd/jparser/jparser.go

API

  • [GET] /worker - does random work
  • [POST] /json-parser - validates and parses request in JSON format and beautifies it
  • [POST] /jsonapi-parser - validates and parses request in JSON:API format and beautifies it

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	DoSomeWork(http.ResponseWriter, *http.Request)
	ParseJSON(http.ResponseWriter, *http.Request)
	ParseJSONapi(http.ResponseWriter, *http.Request)
}

Handler is a request handler interface

type RequestHandler

type RequestHandler struct {
	// contains filtered or unexported fields
}

RequestHandler handles http requests

func NewRequestHandler

func NewRequestHandler() *RequestHandler

NewRequestHandler creates new http request handler

func (*RequestHandler) DoSomeWork

func (h *RequestHandler) DoSomeWork(w http.ResponseWriter, r *http.Request)

DoSomeWork does some dummy work

func (*RequestHandler) ParseJSON

func (h *RequestHandler) ParseJSON(w http.ResponseWriter, r *http.Request)

ParseJSON parses and beautifies input in json format

func (*RequestHandler) ParseJSONapi

func (h *RequestHandler) ParseJSONapi(w http.ResponseWriter, r *http.Request)

ParseJSONapi parses and beautifies input in JSON:API format

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is an main application server

func NewServer

func NewServer(reqLimit float64) *Server

NewServer creates new server object

reqLimit is number of connections per second allowed for each ip

func (*Server) Start

func (s *Server) Start() error

Start runs the server

func (*Server) Stop

func (s *Server) Stop()

Stop shuts the server down

Directories

Path Synopsis
cmd
jparser command

Jump to

Keyboard shortcuts

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