johanbook / express-ip-logging-middleware

An Express middleware that looks up incoming IP addresses and logs them

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express-ip-logging-middleware

This is an example of how one can create an Express middleware that looks up incoming IP addresses and logs them. This can be useful for inspecting traffic on a server. Note that the used IP lookup API is ratelimited and needs a paid subscription for a larger amount of lookups.

Configuring a logger

The express-ip-logging-middleware requires an external logger to work. I recommend the Winston logger for this. See src/server.ts for an example configuration.

About

An Express middleware that looks up incoming IP addresses and logs them


Languages

Language:TypeScript 77.7%Language:JavaScript 17.8%Language:Shell 4.6%