npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rigo-proxy-beta

v0.0.4-alpha

Published

A proxy cli for itercepting network

Downloads

0

Readme

rigo

(Request interceptor in GO) In escense rigo is a reverse Proxy cli with the ability to intercept and modify requests and responses defined on a configuration file.

Use cases

Rigo becomes really useful when testing apps or services that are interconnected or dependent on external services. For example:

  • Mock an entire backend with custom responses. This would allow testing services with limited connectivity or ahead of development.
  • Intercept specific responses that change the behavior of the system under test. This allows to modify and test the behavior of the system under test withouht changing the behavior of it's dependencies.

Install rigo

Rigo is distributed as a npm package:

npm i -g rigo-proxy

Running rigo

Running rigo is as simple as execute the cli app passing the flags:

./rigo -p 8400 -f rigo.yaml

Flags

| Flag | Name | Description | Default | |------|-------|-------------| ------------| | p | port | Port number to run the proxy on | 8400 | f | file | Configuration file to use | rigo.yml | v | verbose | To make the logs more verbose (useful when dealing with CORS) | false | record | record | Record request/response instead of patching | false

Configuration file

This is a configuration file that can be used as an example:

# url that requests will be proxied to
target_url: https://api.somerealapi.com/
# in case authentication need to be appended to the requests
# this is a real use case when requests are sent on the cookie headers
authentication:
    bearer:
        type: Bearer
        token: "sometoken"
intercept:
# network can be modified after returning from the service
# useful in case of patching, or mixing the response with the status code
  responses:
# match is how we will match the intercept with the outgoing or incoming requests
# matching:
#    should contain a uri, 
#    but also optional the methods and query params
    - match:
        uri: "*/libraries/*/books"
        methods: 
          - GET
        params: 
          - name: search
            value: book
# patch is how we will modify the intercepted call
# patching:
#    should contain the type of patch, the type could be file, string or json
#    but also option the code for the response. (default 200 if not specified)   
      patch:
        type: string
        body: 'this is the patched body'
        code: 500
# network can also be intercepted and returned withouht reaching the service
# useful when we know in advance the response type that is expected
  requests:
    - match:
        uri: "*/libraries/*/books"
        methods: 
          - GET
      patch:
        type: json
        body: |
          {
            'books': [
              {
                "createdAt": "2022-12-30T18:00:51Z"
            }]
          }
    - match:
      uri: "*/customer"
      methods: 
        - GET
        - POST
      patch:
        code: 500
    - match:
      uri: "*some-otherrequest*"
      methods: 
        - GET
        - POST
      patch:
        body: ./file.json
        type: file