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

daproxy

v0.0.6

Published

Reverse proxy and static server for local development

Downloads

9

Readme

DaProxy

Simple reverse proxy and HTTP server written in NodeJS using node-http-proxy and node-http-server.

This server is meant for development use, but it is based on production-ready proxy server from NodeJitsu. It is capable of listening on port 80 and thus serving as a frontend server. It serves static files and has support for directory indexes.

This package was previously known as DevProxy, but has been since renamed to avoid conflicts with other packages on NPM.

Installation

Install directly from this repository:

npm install daproxy

This creates a proxy command that you can use to start the proxy.

Summary

proxy
proxy [-c] FILE
proxy [-p PORT] [-t TARGET] [-r ROOT_URL] [-s STATIC_DIR] [-n]

Run the following command to get more information about the relevant command line options:

node proxy.js -h

FILE

This argument is an optional configuration file that can be used to customize the defaults. The file should contain a single object with following optional keys:

  • baseDir: Base directory for static files (default: 'www')
  • target: Target host to be proxied (default: 'http://localhost:80/api')
  • rootPath: The path at which proxied host is accessed locally (default: path portion of target)
  • port: Port on which the proxy will listen (default: '8080')
  • noLang: Whether to prevent relaying of the 'Accept-Language' header (default: false)

The target host URL can use both http and https protocols. Currently username and password embedded in the URL will be ignored. Please use some other form of authentication if possible. The port and path are honored. The path portion will also be used as the default value of rootPath.

Since version 0.0.2, it is also possible to specify multiple targets and root paths. Use an array for each. When specifying multiple targets nad rootPaths, keep in mind that they are always paired, even though they are specified in separate keys. This is mostly for backwards compatibility of the configuration file format.

The noLang option can be useful on misbehaving API servers that redirect to language-specific URL instead of responding to requests. If you detect that the responses are always redirects or HTTP 404 at wrong URL, try setting this option to true. It is generally safe to have this set to true on most API servers, since API servers are not supposed to honor the Accept-Language header anyway.

Example can be found in example/proxy.json.

Volo target

Take a look at eample/volofile for an example serve target that uses this script.

Support

This is an internal tool used at CloudHorizon. Although it is publicly accessible, and we generally support it for our own needs, don't expect to get support for it or anythhing along those lines. But reports are welcome, though, and we usually respond to them. Patches and pull requests are even more welcome.

Known issues

  • This server always listens on all interfaces. This is not (yet) configurable.
  • The URLs returned from the target host are not rewritten.