Methods
-
register() → {void}
-
Description
Define a generic route for all requests Following holds true for all the generic routes i.e. GET, POST, DELETE, PUT We create a parser object by initializing our Parser class with request, response and mocksDir objects The parser object in turn will give us access to the path of a matched directory for an incoming request. Depending on the HTTP Method of the incoming request we append /GET.mock, /POST.mock, /DELETE.mock or /PUT.mock to the matched directory Parse object also gives us access to a method getResponse which does the following tasks:
- Read the response from the specified file
- Run all the handlebars compilations as required.
- Generate a HTTP Response
- Send the response to client.
Returns
Details