This package has been deprecated

    Author message:

    This package is no longer maintained, consider using fetch() and CORS instead

    @financial-times/n-jsonp

    2.4.1 • Public • Published

    Next JSONP

    Contins both a client (bower) and server (npm) module

    Client

    Emulate fetch's interface, but use JSONP under the hood

    Install

    bower install -S n-jsonp
    

    Usage

    import jsonpFetch from 'n-jsonp';
    const opts = {
        timeout: 1000
    };
    jsonpFetch('http://other.domain.com/foo', opts)
        .then(data => {
            ...
        });
    

    Note: If using CommonJS modules,

    const jsonpFetch = require('n-jsonp').default;
    

    Where opts can take

    • {number} [timeout=2000]

    Server

    Express middleware, to work with the client module

    Install

    npm install -S @financial-times/n-jsonp
    

    Usage

    import app from 'express';
    import jsonpMiddleware from '@financial-times/n-jsonp';
    
    app = express();
    app.use(jsonpMiddleware);
    app.get('/', (req, res) => {
        res.jsonp('a response');
    });
    

    Note: If using CommonJS modules,

    const jsonpFetch = require('@financial-times/n-jsonp').default;
    

    Development

    Setup

    Requires

    $ make install
    

    Testing

    Requires Firefox

    $ make test
    

    Keywords

    none

    Install

    npm i @financial-times/n-jsonp

    DownloadsWeekly Downloads

    5

    Version

    2.4.1

    License

    MIT

    Last publish

    Collaborators

    • emmalewis
    • aendra
    • briggsc
    • the-ft
    • quarterto
    • rowanmanning
    • mattandrews
    • jakedchampion
    • sdbernard
    • bobhaslett
    • joannaskao
    • robinmarr-ft
    • ft-internal-products
    • chee
    • notlee
    • tatiana.stantonian
    • conor-mullen
    • alexwilson