pobox

command module
v0.0.0-...-c6f0886 Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: MIT Imports: 13 Imported by: ? 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

CircleCI GoDoc Go Report Card

pobox

POBox is a eary-to-run web server which will accept and log all incoming requests.

POBox provides a simple solution for mocking API requests and responses, as well as a method for loggin web hooks and integrations.

⚠ Right now pobox is still in progress, and does't have any releases. For now, run at your own risk ⚠

Quickstart

POBox is a Golang application. As such, you will need to Go installed in order to run the application.

$ go install github.com/clagraff/pobox
$ pobox

After that, use cURL to see it in action:

$ curl localhost:8080
$ curl -X POST -d 'this is data!' localhost:8080/whatever/route/i/want
$ curl -X OPTIONS localhost:8080/fiiz/buzz?anything=here

Routes

Using the pobox <route-file> argument, you can specify a .json or .yaml file which supplies pre-defined routes.

These routes specify a regex pattern for which URIs and methods to react to, and supply response information.

This is useful in the event a web-hook requires a specific response back.

Here is an example .yaml route file:

# routes.yaml
-
    request:
        uri: /[fF]izz/buz{1,3}  # regex pattern for matching URIs
        method: get|post        # regex pattern for matching request methods
    response:
        body: |                 # Multi-line string response
            <html>
                <body>
                    <h1>My Response</h1>
                    <p>this is my response</p>
                </body>
            </html>
$ pobox routes.yaml &
$ curl http://localhost/hello/world
$ curl http://localhost/Fizz/buzz
<html>
    <body>
        <h1>My Response</h1>
        <p>this is my response</p>
    </body>
</html>

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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