blob: e86ad9bd878204442d551a548cd23c4fb712e48c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/**
* 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 }
|