This post contains content about Now 1.0 – Learn about the latest version, Now 2.0.
Now 2.0 - Upgrade Available
Our mission has always been to make the cloud as simple and accessible as possible. With every product released, we're thriving for the maximum level of transparency. Following this philosophy, we created a huge open source orbit around the ZEIT sphere (even our stack for static deployments is publicly accessible).
To keep this universe growing and make it even easier for you to replicate your production setup in development, we're now releasing a new OSS package on the heels of our path alias announcement – named micro-proxy.

What It Does

From now on, you can route your microservices and frontends with micro, using the same configuration format that powers path alias (the production counterpart to micro-proxy).

Setting It Up

In order to enjoy these features, firstly install it from npm:
npm i -g micro-proxy
Then create a JSON file with a name of your choice (we suggest rules-dev.json, so that you can use rules-prod.json for the production rules) and fill it with path alias rules, just like you would for making it work in production.
For example, this is how it would look if your main site is running on port 3000, your blog on 4000 and a microservice for supplying the blog with data on port 5000:
{
  "rules": [
    {"pathname": "/article-list", "method": ["GET"], "dest": "http://localhost:5000"},
    {"pathname": "/blog", "method": ["GET"], "dest": "http://localhost:4000"},
    {"pathname": "/**", "dest": "http://localhost:3000"}
  ]
}
As you can see, the dest properties (the alias destination) point to ports on your local device, rather than to addresses of other deployments on the web.
This makes it very easy to locally run multiple APIs and frontends at the same time and make them all communicate with each other smoothly. However, you can also put a URL that points to a place on the web here.

Running It

Once you're done with configuring your path alias rules, run micro-proxy like this:
micro-proxy -r rules-dev.json
Just like now alias -r rules-prod.json, this will connect all the specified URLs to their respective paths:
The only difference is that the paths will be relative to localhost (instead of your deployment), which means the above example will lead to your path alias proxy running at http://localhost:9000 (the default port is 9000, change it with -p).

Programmatic Usage

For those of you who'd like to include micro-proxy in an existing script: We also have you covered!

Caught a Bug?

Just as you would expect it, micro-proxy is fully open-source. This means that we would be happy to accept any form of contribution of your side, if you're interested in fixing a bug or adding a feature.
In addition to checking out the code, also make sure to join our community if you have any questions.