Skip to content

Commit

Permalink
update(async/await, error handling, helper function, validation): som…
Browse files Browse the repository at this point in the history
…e updates to imporve the config generator function
  • Loading branch information
imanimen authored and markpash committed Nov 5, 2024
1 parent bc8c735 commit c423d4a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const configFolder = path.join(__dirname, 'config');
// Create an HTTP server
const server = http.createServer(async (req, res) => {
try {
const urlData = url.parse(req.url);
const queryParams = queryString.parse(urlData.query);
const queryId = queryParams.id; // Extract the 'id' from the query string
const urlData = url.parse(req.url); // Parse the URL
const queryParams = queryString.parse(urlData.query); // Parse the query string using querystring
const queryId = queryParams["id"]; // Extract the 'id' from the query string

// Validate the 'id' format (MD5 hash of a MAC address)
if (!isValidId(queryId)) {
Expand Down

0 comments on commit c423d4a

Please sign in to comment.