These variables are declared multiple times. Perhaps you can declare them at the top of the function and assign their values in the if?
```
var isAquabrower = false;
var isSummon = false;
if (req.params.api) {
    // Store the specified engine
    var engine = req.params.api.toLowerCase();

    isAquabrowser = (engine === 'aquabrowser');
    isSummon = (engine === 'summon');
    [...]
} else {
    // Check if an API has been specified
    if (query.api) {
        isAquabrowser = (query.api === 'aquabrowser');
        isSummon = (query.api === 'summon');
    }
    [...]
}
```