Let's discuss your Request Header Parser Microservice

Hi everyone, just finished my Request Header Parser Microservice!:


I am using the ua-parser module for the user agent header and accepts module for the accept-language header!

Any feedback to improve the code appreciated!

Can you share the GitHub link your code?

Here’s mine:
Heroku: https://pure-atoll-37904.herokuapp.com

Gh: https://github.com/JacksonBates/request-header-parser-microservice-fcc

sure! here it is: https://github.com/chemok78/fcc-jay-request-header-parser

Hi Jackson, what does this code do in your app?:

var ip = request.headers[‘x-forwarded-for’] ||

         request.connection.remoteAddress ||
         request.socket.remoteAddress ||

I was having trouble getting an IPv4 address - I kept getting IPv6. This was a snippet I got from stack overflow that fixed my issue, but I’ve seen other examples since that didn’t need this, so I’ll revisit it some time to see how necessary it really is and how to simplify it.

I notice we use different ua parser modules - that may be where my issue was with my ip.

yeah im using this one https://www.npmjs.com/package/ua-parser, which works fine for me

Project Link => https://req-parser.herokuapp.com/
Source Code => https://github.com/AungMyoKyaw/RequestHeaderParser

Project Link – > https://brusbilis.com/freecodecamp/v1/apis/parser/parser.html

Source Code --> https://github.com/brusbilis/freeCodeCamp/tree/master/v1/back-end/apis

This seemed too easy, if not for that nasty ip quirk…

Project link => https://headerparsermicroservice.herokuapp.com/api/whoami
Source code: https://github.com/pilgrim011/headerParser

Project link: https://headerparser-joey.herokuapp.com/

Source code: https://github.com/AsimoLoveGym/Request-Header-Parser-Microservice

Just tested on my side, if any issue from your visit, please let me know.

Live project link
GitHub source code

Happy to hear any opinions, comments, suggestions, etc. :slight_smile:

Nice - does chalk just pretty up the console logging?

Yep, it just gives you the ability to make console.logs different colors. Definitely not necessary, but makes life a tad more fun and/or occasionally easier. :slight_smile:

From Chalk’s readme:


If you’re on Windows, do yourself a favor and use cmder instead of cmd.exe."

True dat, chalkie :slight_smile:

1 Like

Project link: https://req-header-parser.gomix.me/
Code: https://github.com/svmi3195/req-header-parser

I tried to do it with node only, I hope it works for all (kinda does for me, but haven’t tested much yet)

Project link https://github.com/davidpickup/headerparser

This was quite straightforward after the micro service. Just had to work out the regex for parsing the OS.

Heroku: https://requestheaderparserforfcc.herokuapp.com/
Github: https://github.com/olddognewtrix123/reqheaderparser

Hi All! Please take a moment and let me know if this app is working correctly for you.


Thank you!



This one seemed pretty straightforward, but testing is tricky. Does anyone know a way of mocking GET requests from other IP addresses?