A httpplease plugin to prefix all URLs.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.babelrc
.editorconfig
.eslintrc
.gitignore
.npmignore
.travis.yml
license
package.json
readme.md

readme.md

httpplease-prefix

Build Status npm

A httpplease plugin to prefix all URLs.

Installation

npm install --save httpplease-prefix

Usage

The function accepts a string parameter. If not supplied, it defaults to /api.

ES6

import httpplease from 'httpplease';
import prefix     from 'httpplease-prefix';

const http  = httplease.use(prefix());
const http2 = httpplease.use(prefix('/api/v1'));

http.get('/me');  // Will call /api/me
http2.get('/me'); // Will call /api/v1/me

ES5

var httpplease = require('httpplease');
var prefix     = require('httpplease-prefix');
var http       = httpplease.use(prefix());
var http2      = httpplease.use(prefix('/api/v1'));

http.get('/me');  // Will call /api/me
http2.get('/me'); // Will call /api/v1/me

License

Copyright © 2015 Neil Kistner

Released under the MIT license. See license for details.