next.config.ts 478 B

12345678910111213141516171819202122
  1. import type { NextConfig } from "next";
  2. const nextConfig: NextConfig = {
  3. /* config options here */
  4. async rewrites() {
  5. const apiUrl = process.env.API_URL || "http://localhost:3001";
  6. return [
  7. {
  8. source: "/api/:path*",
  9. destination: `${apiUrl}/:path*`
  10. },
  11. // WebSocket support for socket.io
  12. {
  13. source: "/socket.io/:path*",
  14. destination: `${apiUrl}/socket.io/:path*`
  15. }
  16. ];
  17. }
  18. };
  19. export default nextConfig;