Skip to content

LoganSimonsen/easypost-http-proxy-example

Repository files navigation

This is an example of using http-proxy-middleware to create a development server to make requests to the EasyPost API. The reason you may use this when developing against the EasyPost API, is due to the fact that EasyPost rejects alls requests coming directly from a browser. So if you want 1 simple development server to test out any EasyPost functionality and you are developing browser based applications, this could be a good option for you.

Install Dependencies

npm install

nodemon is technically optional, but can be helpful when making/testing changes to the server.

cors will enable cross-origin support

http-proxy-middleware will help proxy HTTP requests between our front end application and the EasyPost API.

Create .env File

touch .env

File should look something like this:

EP_TEST_KEY=E4321FDSA
EP_PRODUCTION_KEY=E1234ASDF

Replace the example keys above with your EasyPost API keys which you can get from the EasyPost Dashboard (development accounts are free)

Starting the Server

npm nodemon server

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published