Skip to content

Commit

Permalink
Add page logging (#65)
Browse files Browse the repository at this point in the history
* Add page logging
* Update logging
  • Loading branch information
srikanthlogic authored Jan 5, 2024
1 parent 710895d commit 713d886
Show file tree
Hide file tree
Showing 5 changed files with 301 additions and 251 deletions.
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export COUNTRY_OF_QUERY=IN
export LOGGING=true
5 changes: 4 additions & 1 deletion Spacefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ micros:
env:
- name: COUNTRY_OF_QUERY
description: Country parameter to be defaulted for all requests
default: "US"
default: "US"
- name: LOGGING
description: Sets LOGGING
default: "false"
7 changes: 5 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ const router = Express.Router();

const toList = (apps) => ({ results: apps });


router.use((req, res, next) => {

if (!req.query.country) {
req.query.country = process.env.COUNTRY_OF_QUERY || 'US';;
}

if (process.env.LOGGING || false) {
console.log("GPlayAPI", req.url, req.baseUrl, req.params)
}

next();
});

Expand Down Expand Up @@ -260,4 +263,4 @@ function errorHandler(err, req, res, next) {

router.use(errorHandler);

export default router;
export default router;
Loading

0 comments on commit 713d886

Please sign in to comment.