httpplease-prefix
v0.1.0
Published
A httpplease plugin to prefix all URLs.
Downloads
3
Readme
httpplease-prefix
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.