Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timneutkens/rest-path-suffix
Rest.js interceptor to add a suffix to the request path
https://github.com/timneutkens/rest-path-suffix
Last synced: 21 days ago
JSON representation
Rest.js interceptor to add a suffix to the request path
- Host: GitHub
- URL: https://github.com/timneutkens/rest-path-suffix
- Owner: timneutkens
- Created: 2016-01-23T12:25:34.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-23T14:20:49.000Z (almost 9 years ago)
- Last Synced: 2024-10-05T12:43:29.512Z (3 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rest.js path suffix
Rest.js interceptor to add a suffix to the request path## Installation
Install Rest.js first if you haven't already.
```
npm install --save rest
```Install path suffix interceptor
```
npm install --save rest-pathsuffix
```Please note that this module is written in es2015 (es6). So you will need a transpiler like [Babel](http://babeljs.io) to use it.
## How to use
```
const rest = require('rest'),
pathSuffix = require('pathsuffix');// Wrap pathSuffix interceptor
// Add .json to end of url
const client = rest.wrap(pathSuffix, { suffix: '.json' });// Calls /products.json
client('/products').then(response => {
console.log(response);
});
```