diff options
| author | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2024-04-17 18:32:13 +0300 |
|---|---|---|
| committer | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2024-04-17 18:32:13 +0300 |
| commit | d9364679a51ff80db8e5948ab089d749da36a6b2 (patch) | |
| tree | f847a03a017be8857923aaaae9f8dcf7177b2ba9 /app/utils/url-util.js | |
| parent | 6248d2cf7a2214ac32628bc58248694108b4d8bf (diff) | |
| download | oseine-development.tar.gz oseine-development.tar.bz2 oseine-development.zip | |
dockerize the appHEADmasterdevelopment
Diffstat (limited to 'app/utils/url-util.js')
| -rw-r--r-- | app/utils/url-util.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/utils/url-util.js b/app/utils/url-util.js new file mode 100644 index 0000000..e86ad9b --- /dev/null +++ b/app/utils/url-util.js @@ -0,0 +1,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 }
\ No newline at end of file |
