Class: AdServerURL

urls~AdServerURL

(abstract) new AdServerURL(hostname, secure_hostname, query_schema, path, port)

Abstract class to contain base methods used for constructing & parsing adserver URL's.

Parameters:
Name Type Description
hostname String

domain & port #, if applicable. Ex: 'localhost:5000' or 'ads.cliquesads.com'

secure_hostname String

domain & port #, if applicable. Ex: 'localhost:5000' or 'ads.cliquesads.com'

query_schema Object

object containing query parameters expected for a given URL that specifies the level of encoding / decoding to perform for each

path String

path for this URL

port Number

port number if applicable, otherwise 'null'

Source:

Methods

format(query, secure)

Lightweight wrapper around url.format to encode any query params which are expected to be encoded, and return fully formed URL.

Any query values in query arg will be encoded according to this.query_schema and added to the formatted URL.

Any query values in query_schema AND NOT in query object will be formatted as macros using standard macro delimiters.

Stores resulting URL on instance as this.url

Parameters:
Name Type Description
query Object

object containing a URL's query param keys & values

secure Boolean
Source:

parse(query, secure)

Parses & decodes URL query params from raw URL

Doesn't actually parse the whole string since Express parses out query params for you into an object, so just pass request.query as query argument.

Parameters:
Name Type Description
query Object

output of request.query

secure Boolean
Source: