From d9364679a51ff80db8e5948ab089d749da36a6b2 Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Wed, 17 Apr 2024 18:32:13 +0300 Subject: dockerize the app --- app/utils/url-util.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/utils/url-util.js (limited to 'app/utils/url-util.js') 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 -- cgit v1.2.3