1.0.1 • Published 8 years ago
superagent-node-plugin v1.0.1
superagent-node-plugin
Allow you to custom port while calling AJAX with superagent
Installation
$ npm install --save superagent-node
How it work
Custom port call
import request from 'superagent'
import superagentNodePlugin from 'superagent-node-plugin'
request.
get('/api/v1/users').
use(superagentNodePlugin(3000)).
end((err, { body }) => {
// ...
})
or using custom port from process.env.PORT
request.
get('/api/v1/users').
use(superagentNodePlugin()).
end((err, { body }) => {
// ...
})
PORT=3000 npm index.js
Test
Install package dependencies and run test command
npm run test
Credit
FakeRainBrigand
http://stackoverflow.com/questions/26463924/getting-rid-of-localhost3000-urls-for-reactasync