GithubHelp home page GithubHelp logo

fibertools's Introduction

Fiber Tools

This is a simple package with small tools to make fiber even nice then it already is. Also has support for easily debugging error stack traces on panics and general errors.

Install

$ go get github.com/incizzle/fibertools
import fibertools "github.com/incizzle/fibertools"

Usage

Error Handler. Set x-debug on request header to see stack trace.

// Error handler that is passed into `fiber.New()`. Set x-debug in request header to see stack trace of error.
app := fiber.New(fiber.Config{
		ErrorHandler:          fibertools.ErrorHandler,
    })

Get Header

// Pass in fiber context and the specific header you want to pull from the context.
fibertools.GetHeader(c, "user-agent")

New Error

// Error function that can be returned on general errors || panics in order to get stack trace in error handler. Must be used in tandom with fibertools.Recover() for most value.
err, _ := errors.New("ERROR HERE")

return fibertools.NewError(err)

Recover

// Simple fiber recover middleware based around default fiber recover but with the addiction of stack tarcing. Should be used with fibertools.ErrorHandler().
app := fiber.New(fiber.Config{
		ErrorHandler:          fibertools.ErrorHandler,
    })
    
app.Use(fibertools.Recover())

By: iNcizzle#1337
Twitter: iNcizzle

fibertools's People

Contributors

incizzle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ashah360

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.