jquery-request
v0.0.11-0
Published
A micro library to make efficient AJAX calls from nodejs app
Downloads
6
Maintainers
Readme
jquery-request
🚫 UNMAINTAINED 🚫 (Not recommended for use)
jquery-request is an AJAX helper for nodejs apps.
You can use it with your favorite frameworks/libraries like React, Redux, Backbonejs or simply as a request in your nodejs app.
Motivation
Making requests in a nodejs app has always been a tedious task. It's easy to use jQuery AJAX for making requests but you'll end up creating a dirty web of AJAX calls across your app. As the app grows, the number of requests increase and you end up in a mess. Here's where jquery-request comes in. It helps you make all your configurations in one place and use the request API from anywhere in your app. Also, you can mould the APIs in whatever form you're comfortable with. It even makes it easy to write tests for your network calls.
Influences
jquery-request is very much influenced from [isomorphic-fetch]. To make it clear, jquery-request neither implements nor is an extension of any of the libraries stated above. It's just been influenced by the simplicity of the these libraries.
Installation
To install the stable version:
npm install --save jquery-request
How To Use
To do the basic configuration for your requests, you will use setupDefaults. Currently supported default configuration is base_url and headers, which you pass as a plain JSON object. Once done, you can start making your calls using the jquery-request API.
Please Note: The url value you pass in the request APIs, will be appended to the base_url you defined with setupDefaults. Henceforth, initialization with setupDefaults is mandatory.