Fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework.

Overview

fastglue

Overview Go Reference Zerodha Tech

fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework. It helps eliminate boilerplate that would otherwise be required when using these two libraries to write HTTP servers. It enables:

  • Performance benefits of fasthttp + fasthttprouter.
  • Pre/post middleware hooks on HTTP handlers.
  • Simple middlewares for validating (existence, length range) of params in HTTP requests.
  • Functions for unmarshalling request payloads (Form encoding, JSON, XML) into arbitrary structs.
  • Shortcut functions for registering handlers, GET(), POST() etc.
  • Shortcut for fasthttp listening on TCP and Unix sockets.
  • Shortcut for graceful shutdown hook on the fasthttp server.
  • Opinionated JSON API response and error structures.
  • Shortcut functions for sending strings, bytes, JSON in the envelope structure without serialization or allocation.

Install

go get -u github.com/zerodha/fastglue

Usage

import "github.com/zerodha/fastglue"

Examples

Issues
  • chore(deps): bump github.com/valyala/fasthttp from 1.32.0 to 1.34.0

    chore(deps): bump github.com/valyala/fasthttp from 1.32.0 to 1.34.0

    Bumps github.com/valyala/fasthttp from 1.32.0 to 1.34.0.

    Release notes

    Sourced from github.com/valyala/fasthttp's releases.

    v1.34.0

    • 59f94a3 Update github.com/klauspost/compress (#1237) (Mikhail Faraponov)
    • 62c15a5 Don't reset RequestCtx.s (#1234) (Erik Dubbelboer)
    • 7670c6e Fix windows tests (#1235) (Erik Dubbelboer)
    • f54ffa1 feature: Keep the memory usage of the service at a stable level (#1216) (Rennbon)
    • 15262ec Warn about unsafe ServeFile usage (#1228) (Erik Dubbelboer)
    • 1116d03 Fix panic while reading invalid trailers (Erik Dubbelboer)
    • 856ca8e Update dependencies (#1230) (Mikhail Faraponov)
    • 6b5bc7b Add windows support to normalizePath (Erik Dubbelboer)
    • f0b0cfe Don't log ErrBadTrailer by default (Erik Dubbelboer)
    • 6937fee fix: (useless check), skip Response body if http method HEAD (#1224) (Pavel Burak)
    • b85d2a2 Fix http proxy behavior (#1221) (Aoang)
    • ad8a07a RequestHeader support set no default ContentType (#1218) (Jack.Ju)
    • c94581c support configure HostClient (#1214) (lin longhjui)
    • 632e222 Client examples (#1208) (Sergey Ponomarev)
    • 6a3cc23 uri_test.go use example.com for clearness (#1212) (Sergey Ponomarev)
    • 9d665e0 Update dependencies (#1204) (Mikhail Faraponov)
    • 8d7953e Fix scheme check for not yet parsed requests (#1203) (ArminBTVS)

    v1.33.0

    • 61aa8b1 remove redundant code (#1202) (tyltr)
    • 4369776 fix(hijack): reuse RequestCtx (#1201) (Sergio VS)
    • 2aca3e8 fix(hijack): reset userValues after hijack handler execution (#1199) (Sergio VS)
    • 9123060 Updated dependencies (#1194) (Mikhail Faraponov)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • feat: support unmarshalling custom structs with json.Unmarshaller

    feat: support unmarshalling custom structs with json.Unmarshaller

    This commit adds support for unmarshalling custom structs which implement the json.Unmarshaller interface. This allows fastglue.ScanArgs to be able to decode custom structs as well if they implement the UnmarshalJSON method on them.

    opened by rhnvrm 0
  • feat: adds UnmarshalArgs - A function to unmarshal query args

    feat: adds UnmarshalArgs - A function to unmarshal query args

    UnmarshalArgs - A function to unmarshal query args to struct with json tags

    Known limitation: args-to-json conversion does not take array notations into account, treats array key as string. eg: Legs[1]=Insights will be converted to json as follows: {Legs: {1: Insights}}

    opened by joicemjoseph 0
Releases(v1.7.1)
  • v1.7.1(Mar 31, 2022)

    What's Changed

    • feat: support unmarshalling custom structs with json.Unmarshaller by @rhnvrm in https://github.com/zerodha/fastglue/pull/5
    • chore(deps): bump github.com/valyala/fasthttp from 1.32.0 to 1.34.0 by @dependabot in https://github.com/zerodha/fastglue/pull/6

    New Contributors

    • @rhnvrm made their first contribution in https://github.com/zerodha/fastglue/pull/5
    • @dependabot made their first contribution in https://github.com/zerodha/fastglue/pull/6

    Full Changelog: https://github.com/zerodha/fastglue/compare/v1.7.0...v1.7.1

    Source code(tar.gz)
    Source code(zip)
  • v1.7.0(Jan 21, 2022)

    What's Changed

    • Fix broken example links by @abhinavxd in https://github.com/zerodha/fastglue/pull/3
    • Add method for relative redirect and update fashttp+router by @vividvilla in https://github.com/zerodha/fastglue/pull/4

    New Contributors

    • @abhinavxd made their first contribution in https://github.com/zerodha/fastglue/pull/3
    • @vividvilla made their first contribution in https://github.com/zerodha/fastglue/pull/4

    Full Changelog: https://github.com/zerodha/fastglue/compare/v1.6.7...v1.7.0

    Source code(tar.gz)
    Source code(zip)
  • v1.6.7(Sep 15, 2021)

  • v1.6.6(Jun 22, 2021)

Owner
Zerodha Technology
Zerodha Technology
This project implements p11-kit RPC server protocol, allowing Go programs to act as a PKCS #11 module without the need for cgo

PKCS #11 modules in Go without cgo This project implements p11-kit RPC server protocol, allowing Go programs to act as a PKCS #11 module without the n

Google 27 May 7, 2022
A suite of microservices for software-defined networking (SDN) and bare-metal provisioning

M3L is a suite of microservices for software-defined networking (SDN) and bare-metal provisioning, which store their data as Custom Resources in Kubernetes.

Nicklas Frahm 0 Jan 19, 2022
🦄🌈 YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go.

???? YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go. Support Nacos ,Consoul ,Etcd ,Eureka ,kubernetes.

YoyoFx 533 May 1, 2022
Go Micro is a framework for distributed systems development

Go Micro Go Micro is a framework for distributed systems development. Overview Go Micro provides the core requirements for distributed systems develop

Asim Aslam 18.2k May 15, 2022
Micro-service framework in Go

Kite Micro-Service Framework Kite is a framework for developing micro-services in Go. Kite is both the name of the framework and the micro-service tha

Koding, Inc. 3.1k May 15, 2022
NewSQL distributed storage database based on micro service framework

QLite 是基于微服务的 NewSQL 型数据库系统,与传统的一体化数据库不同,该系统将本该内置的多种数据结构(STL)拆分成多个服务模块,每个模块都是独立的一个节点,每个节点都与其主网关进行连接,从而形成分布式存储结构。

null 30 Mar 25, 2022
a microservice framework for rapid development of micro services in Go with rich eco-system

中文版README Go-Chassis is a microservice framework for rapid development of microservices in Go. it focus on helping developer to deliver cloud native a

null 2.5k May 9, 2022
Another excellent micro service framework

xservice [WIP] Another excellent micro service framework Features RESTful API (base on echo/v4) gRPC & gRPC gateway service & Swagger document generat

新片场 8 Apr 27, 2022
😈 Simple micro-front-end framework.

Development and Maintenance Status RancherOS 1.x is no longer being actively maintained. There are two significant reasons behind this product decisio

Matt D 0 Jan 5, 2022
A code generator that turns plain old Go services into RPC-enabled (micro)services with robust HTTP APIs.

Frodo is a code generator and runtime library that helps you write RPC-enabled (micro) services and APIs.

Monadic 17 Apr 21, 2022
Automatic Service Mesh and RPC generation for Go micro services, it's a humble alternative to gRPC with Istio.

Mesh RPC MeshRPC provides automatic Service Mesh and RPC generation for Go micro services, it's a humble alternative to gRPC with Istio. In a nutshell

AstraNet Toolkit 68 Apr 19, 2022
micro-draft-manager is a microservice that helps you to manage unstructured data in your application with sorting and full-text search

micro-draft-manager is a microservice that helps you to manage unstructured data in your application with sorting and full-text search. For example, y

Hamed Abdollahpour 1 Nov 24, 2021
Study Project for the application of micro services and requisition controls

Starting Endpoint GO with Retry Request Install GoLang for Linux Tutorial: LINK

Antenor Pires 3 Dec 29, 2021
An opinionated Microservice starter in Go

Go Microservice Starter An opinionated Microservice starter in Go Usage Checkout the code. TLDR; Start the service: docker build -t go-microservice-st

Abhisek Datta 1 Oct 25, 2021
Micro is a platform for cloud native development

Micro Overview Micro addresses the key requirements for building services in the cloud. It leverages the microservices architecture pattern and provid

Micro 11.1k May 15, 2022
goTempM is a full stack Golang microservices sample application built on top of the Micro platform.

goTempM is a full stack Golang microservices sample application built on top of the Micro platform.

null 25 Apr 28, 2022
微服务架构-micro-基于go-zero zrpc etcd 单独集成orm-gorm 日志-uber/zap

micro目录结构 pkg ├── api 业务接口逻辑层 所有的业务逻辑存放目录。 │ ├── model 数据模型 数据管理层,仅用于操作管理数据,如数据库操作 ├── assets

jiwei 8 Apr 26, 2022
A Micro-UTP, plug-able sanity checker for any on-prem JFrog platform instance

hello-frog About this plugin This plugin is a template and a functioning example for a basic JFrog CLI plugin. This README shows the expected structur

rdar 0 Dec 7, 2021
Go micro frame cli tool

go-micro-frame cli tool install git clone [email protected]:jettjia/go-micro-frame-cli.git cd go-micro-frame-cli go build -ldflags "-w -s" -o go-micro-f

jettjia 5 Apr 13, 2022