API - Router

Router object, this will route the request to the application.

Methods

This method will set the CORS headers to the response.

Parameters
Name Type Description
res Object Nodejs Response Object

Returns :

This method will check if the request is going to a direct file, if so return it. If gzip is enabled and supported it will gzip the response.

Parameters
Name Type Description
req Object Nodejs Request Object
res Object Nodejs Response Object

Returns Promise:

This function will check if there is an update available from NPM. If there is an update, then the user should update manually.

This function will get a single config value, if there is no key given it will return the complete config.

Parameters
Name Type Description
key Name The key of the config value

Returns :

This method will try to match a route to the current request.

Parameters
Name Type Description
req Object

Returns :

This method will try to parse the request if the request a an API request. By default the app and component parameters must be passed in the request.

Parameters
Name Type Description
req Object Nodejs Request Object

Returns Object: The parsed request object.

This method will check if the request is a file, if so it will return the file, if not it will try to find an application and will try to run the component. When a file is found and the gzip option in the config is true it will send a gzipped response.

Parameters
Name Type Description
req Object NodeJS request object
res Object NodeJS response object

This will set an application handler.

Parameters
Name Type Description
alias String The alias of the application
path String The path to the application.

Returns :

This function will set the config of Raddish which is located in a JSON file..

Parameters
Name Type Description
config Object

This function will start the webserver with the right specification.

Parameters
Name Type Description
port Int The late port of the server.