Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ module.exports = async (req, res) => {
const parsed = queryString.parse(req.url.slice(1));
const response = {};

if (!parsed.url) {
response.error = 'valid url is required';
send(res, 400, response);
}
if (parsed.url) {
const options = {
debug: !!parsed.debug || false,
delay: parsed.delay || 500,
maxDepth: parsed.maxDepth || 3,
maxUrls: parsed.maxUrls || 10,
maxWait: parsed.maxWait || 3000,
recursive: !!parsed.recursive || true,
userAgent: parsed.userAgent || 'Wappalyzer',
};
const wappalyzer = new Wappalyzer(parsed.url, options);

const options = {
debug: !!parsed.debug || false,
delay: parsed.delay || 500,
maxDepth: parsed.maxDepth || 3,
maxUrls: parsed.maxUrls || 10,
maxWait: parsed.maxWait || 3000,
recursive: !!parsed.recursive || false,
userAgent: parsed.userAgent || 'Wappalyzer',
};
const wappalyzer = new Wappalyzer(parsed.url, options);

try {
const data = await wappalyzer.analyze();
response.url = parsed.url;
response.options = options;
response.data = data;
send(res, 200, response);
} catch (e) {
response.error = e.message;
try {
const data = await wappalyzer.analyze();
response.url = parsed.url;
response.options = options;
response.data = data;
send(res, 200, response);
} catch (e) {
response.error = e.message;
send(res, 400, response);
}
} else {
response.error = 'valid url is required';
send(res, 400, response);
}
};