/** * url utility */ const querystring = require('querystring'); function struct(req, url) { let url_parts = url.split('?'); let query = (url_parts.length > 1) ? querystring.decode(url_parts[1]) : {}; return { method: req.method, host: req.host, path: url_parts[0], query: query } } /** * exports */ module.exports = { struct }