httpplease-prefix

0.1.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i httpplease-prefix

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • wyze