modulepackage
0.3.7
Repository: https://github.com/mdouchement/middlewarex.git
Documentation: pkg.go.dev
# README
Middlewarex
Bunch of middlewares for Labstack Echo.
Requirements
- Echo 4.x.x
Usage
CRUD
Used for creating RESTful API entrypoints according the given struct.
Versioning
This middleware must be set as a pre middleware.
Doing the following request:
X-Application-Version: vnd.github.v3
GET /toto
will be rewritten as:
GET /v3/toto
Bechmarks
[middlewarex]>> go test -bench .
goos: darwin
goarch: amd64
pkg: github.com/mdouchement/middlewarex
BenchmarkVersioningRW-8 300000 50608 ns/op // With header rewriting
BenchmarkVersioningVRwM-8 5000000 362 ns/op // Just versioned routes with the Versioning middleware present
BenchmarkVersioningVR-8 10000000 215 ns/op // Just versioned routes without the Versioning middleware
PASS
ok github.com/mdouchement/middlewarex 19.850s
If the header is not specified, no rewrittes are applied.
License
MIT
Contributing
All PRs are welcome.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
As possible, run the following commands to format and lint the code:
# Format
find . -name '*.go' -not -path './vendor*' -exec gofmt -s -w {} \;
# Lint
golangci-lint run -c .golangci.yml
# Packages
No description provided by the author
# Functions
CRUD defines the folowwing resources: POST: /path GET: /path GET: /path/:id PATCH: /path/:id DEL: /path/:id.
PASETO returns a JSON Platform-Agnostic SEcurity TOkens (PASETO) auth middleware.
PASETOWithConfig returns a PASETO auth middleware with config.
Versioning rewrites routes to match the last part of the version header.
# Constants
XApplicationStableVersion is the header for the stable API version (e.g.
XApplicationVersion is the header for the asked API version (e.g.
# Variables
DefaultPASETOConfig is the default PASETO auth middleware config.
Errors.
Errors.
# Interfaces
CreateSupported interface.
DeleteSupported interface.
ListSupported interface.
ShowSupported interface.
UpdateSupported interface.
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author