• Introduction
    • TypeScript Introduction
    • Interfaces & Types
    • Generics
    • Utilities
      • Getting Started
    • Render MDX with Next.JS
    • Use Tailwind JIT Mode
    • Use Mongo in Next.JS
    • How to get IP Address in Next.JS
  • Introduction
    • TypeScript Introduction
    • Interfaces & Types
    • Generics
    • Utilities
      • Getting Started
    • Render MDX with Next.JS
    • Use Tailwind JIT Mode
    • Use Mongo in Next.JS
    • How to get IP Address in Next.JS
var ip = req.headers["x-real-ip"] || req.connection.remoteAddress;
if (ip.substr(0, 7) == "::ffff:") {
  ip = ip.substr(7);
  console.log(ip);
}
Use Mongo in Next.JS

MIT 2022 © Shaan Alam.
Edit this page on GitHub