/node-api-proxy

Node API Proxy server that redirects API-calls :fax:

Primary LanguageJavaScript

Node API Proxy

Proxy API-calls through an express-server

This repository contains everything to run a simpler API proxy. You can either use the deploy button to create everything automatically. It should work in most cases. Or you can clone the repo and do it yourself.

Deploy directly to Heroku (requires login):

Deploy

Manual Instructions

1 . Clone repository and cd into the folder.

2 . Install dependencies

npm install

3 . Create a .env file in the root folder and enter your credentials. .env.example is a template for setting your credentials:

API_URL=
API_KEY_NAME=
API_KEY_VALUE=
  1. Start the server by running the start script:
npm start
  1. Make your API-requests to http://localhost:3000 instead.

Manual Deploy

1 . Create an account on https://heroku.com. This should be pretty straight forward.

2 . Install the Heroku CLI on your computer:
https://devcenter.heroku.com/articles/heroku-cli.

Check that you have the heroku-cli installed by checking the version number in your terminal:

heroku --version

3 . Connect the Heroku CLI to your account by writing the following command in your terminal and follow the instructions on the command line:

heroku login

Use your credentials from the earlier account creation.

4 . Then create a remote heroku project, kinda like creating a git repository on GitHub. This will create a project on Heroku with a random name. If you want to name your app you have to supply your own name like heroku create project-name. The command below will just create a random name:

heroku create

5 . Push your app to Heroku like pushing to GitHub expect for origin you have heroku (you will see a wall of code).

git push heroku master

6 . Visit your newly create app by opening it via heroku:

heroku open

If you are getting errors you can view the error logs by running this command:

heroku logs --tail

This might give you a hint on what's wrong.