twitter-proxy

2.0.1 • Public • Published

twitter-proxy NPM version

Tiny Twitter API proxy server

Allows you to make requests to the Twitter API from the comfort of your browser.

Install

npm install -g twitter-proxy

Getting started

  1. Create an app on https://dev.twitter.com – the URLs and name don't matter, you won't be using it to authenticate people

  2. Create a json configuration file, containing your consumer key and secret:

    {
      "consumerKey": "<paste consumer key here>",
      "consumerSecret": "<paste consumer secret here>"
    }
  3. Let's say we save it on ~/config.json

  4. Run the app using the saved config:

    $ twitter-proxy ~/config.json # If installed with npm i -g 
    $ npm start ~/config.json     # If you cloned the repository 

You can now make requests to Twitter APIs by substituting Twitter base URL with http://localhost:port, where port denotes the port that was assigned to this server. As an example, if a prior direct request to Twitter pointed to

https://api.twitter.com/1.1/search/tweets.json?q=%40twitterdev

now, having to pass through the proxy, it points to

http://localhost:port/1.1/search/tweets.json?q=%40twitterdev

Programmatic API

From your node app, just require this module as a function and call it using the config object as the only parameter:

var twitterProxyServer = require('twitter-proxy');
twitterProxyServer({
  consumerKey: '<paste consumer key here>',
  consumerSecret: '<paste consumer secret here>'
});

Configuration

The possible configuration properties, and its default values are:

{
  "consumerKey": "",
  "consumerSecret": "",
  "accessToken": "",
  "accessTokenSecret": "",
  "port": "7890"
}

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i twitter-proxy

Weekly Downloads

0

Version

2.0.1

License

MIT

Unpacked Size

8.26 kB

Total Files

5

Last publish

Collaborators

  • ruyadorno