This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@amjs/ajax-url

0.1.4 • Public • Published

@amjs/ajax-url 0.1.4

Statements Branches Functions Lines

Object URL for any AJAX request

Installation

$ npm i @amjs/ajax-url

Usage

const AmjsAjaxURL = require('@amjs/ajax-url');
const url = new AmjsAjaxURL({
    domain : 'some-domain',
    port   : 3000,
    path   : 'some-path/{id}',
    params : {
        id : 1,
        key: 'value'
    }
});
console.log(url.value); // 'https://some-domain:3000/some-path/1?key=value'

In order to use not secure protocol (http), set the 'unsecure' property to true

const AmjsAjaxURL = require('@amjs/ajax-url');
const url = new AmjsAjaxURL({
    domain   : 'some-domain',
    port     : 3000,
    path     : 'some-path/{id}',
    params   : {
        id   : 1,
        key  : 'value'
    },
    unsecure : true
});
console.log(url.value); // 'http://some-domain:3000/some-path/1?key=value'

Also you can add values assigning direct value:

const AmjsAjaxURL = require('@amjs/ajax-url');
const url = new AmjsAjaxURL();
url.value = {
    domain   : 'some-domain',
    port     : 3000,
    path     : 'some-path/{id}',
    params   : {
        id   : 1,
        key  : 'value'
    },
    unsecure : true
});
console.log(url.value); // 'http://some-domain:3000/some-path/1?key=value'

Readme

Keywords

Package Sidebar

Install

npm i @amjs/ajax-url

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

32.9 kB

Total Files

12

Last publish

Collaborators

  • amjs