Created
May 23, 2021 15:28
-
-
Save simonprickett/4786c884c96b5ff538d7ffdcb91280a1 to your computer and use it in GitHub Desktop.
Getting Started with Express Part 1: Database information route
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.get('/dbinfo', (req, res) => { | |
| const dbKeys = Object.keys(db); | |
| const info = { | |
| size: dbKeys.length | |
| }; | |
| if ('true' === req.query.details) { | |
| info.keys = dbKeys; | |
| } | |
| res.json(info); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment