{"_id":"next-connect","_rev":"47-f5b8d7216935e80cb33b593958788816","name":"next-connect","dist-tags":{"latest":"1.0.0","beta":"0.12.0","next":"1.0.0-next.4"},"versions":{"0.0.1":{"name":"next-connect","version":"0.0.1","description":"The method routing and middleware layer for Next.js API Routes","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^6.2.1","nyc":"^14.1.1","supertest":"^4.0.2"},"gitHead":"49af1c586a75b2b1663f4f0230d9e70c47aeef32","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.0.1","_nodeVersion":"12.10.0","_npmVersion":"6.10.3","dist":{"integrity":"sha512-/Q3xWyz43x9wbiWfJwrQ8i+riKyHCXeQNe/DWpXH5iKb9LNU7FfOG0/56S5uYWBR3gTBH9T7e75kk2OCNjL5Mw==","shasum":"eeb7a6bac963e41c84ef307eb2c3921b5a49b636","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.0.1.tgz","fileCount":5,"unpackedSize":6840,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdo9qECRA9TVsSAnZWagAATxoP/3+L60KzPUuy42YbajXF\nz7y2u6YpA58eYWrogTxSZ9HX53QnDyX6exMJ7FkTxA2OuKpMjSNG36f4B/l5\n4gUdJ9cX5cN0gw9bNKWoszxbTu81wW9nVmSfxb2FndPqBvBZ+qDCOqWkIM8G\nbHLKfqS7NeZP1SgFbpJC9dsekDn0og3kc3MMy1q1mzuT6W9bnE1erC2E1Vyl\nctSC2hbcL/eOjzeknDBjdFwokDwkKO+Bkm02ERg/XQY42AlZMiFexRQc0No7\njlBROGM5N8vslY5YyKp+IBzd1IXxEdAfTPmTJ9fhNIj2CscIxZhG4nxsVhPx\ndNumSqDWekvYRg9JSUxs5ENyAPET3sALwV5tQI2kH1M3/pV0YcV6c0b4H8EH\nmlYQpyeWxtYUDqrIQMUAUeik8YgyPHd1m1Yt9mUl8HMmk7/msz8oHLUZtVZo\nei4dq1eG1zoMMPBPaUWxBO9/Y/kfTPC79GxinOjAJetqtDCzhS1jXeGsr3Bc\nhjNbw5P881JZNOi2+4S9UrQsU3gv/ZIzN1sPv7JHbQitBfWN2z/IpycovnzZ\nQdq/RPKD3/IDJfq0Po5ncY3JKnLejb4YL0K4EC2l3KHNr6TG1x7JpzH5cTRI\nQWkKsd959wEkf/ecw++qamso6YjK0OFKFx5rYPkw+UsdwLHZfk6b6wPbStNe\nnZOb\r\n=h4EG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDVNLynUFI+Na1FxTceqqj3Vj1Min+fzoi6JnEQGiXYCgIhANAelPprxz5M0RLBWaIdgvbMRj5Gien5LM1Dv5QRbKY6"}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.0.1_1571019395545_0.4335274116525516"},"_hasShrinkwrap":false},"0.1.0":{"name":"next-connect","version":"0.1.0","description":"The method routing and middleware layer for Next.js API Routes","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^6.2.1","nyc":"^14.1.1","supertest":"^4.0.2"},"gitHead":"d905c1b085835ee4071297908c4b6245caf07bba","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.1.0","_nodeVersion":"12.10.0","_npmVersion":"6.10.3","dist":{"integrity":"sha512-lAFwTA5vxu72PEb31MuQxagEp47RTEKxttY6FCyoWvta9QPtD+Y6/DW+AVmrwL2uj/R4mooMcLYx5MSHM4G3wQ==","shasum":"b7f96235472540759d172825c389fffbacb1af50","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.1.0.tgz","fileCount":5,"unpackedSize":7646,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpUdDCRA9TVsSAnZWagAA6kMP/2/XfppVuNqsESFYCqDt\neWA3n/H/tzWgCOIEZwb+3k20/ULX5ikMR/L6mv0TSTt0NOvKi5gtE13m4k1f\nXOjy0bQjPHvjr7seHlSH1BvaczktF7vDof0lBALVhKaS0+FvX30NdtOm/cTa\nYnSKjMMkKYsqm6xDg/dNdmVnrG4jBZUDk0wvA1vcN/sR5dQYn2zaOFPTcrg1\n3kzcbhNK79zbUrtcXTbtqDHnaMKNKhP3w4hdOpLo/NES0NmTyNBwiO/DeAhY\nGhWgF4ZjiUT9mLW1ONqH8j80ANPGoUwqOGKOhSXTFZap15z+iGxMbiT5Jnu7\ndFjFDv0J1+gbiFf7YUUPocDATCQl1ZJGHUml/rCRL5P654rqbvSk61VXn8It\nw73rCWeEhGc+NVwo+NVW/9/XwS+cOPq4G03PxWJbX8YYStREdSAtAf/mnapl\nWkiq8lB9pyVCa5p5IMoQ4E/W0EN/lXRvrgIQGilf6ze8xHik/FvdaAt0+6T5\nLxgMuHiuV8AbGtdHSMMX/2yV+siLqenVBby8AhIZUrBm077UGldi3bbbx4I/\nxwUUhYPC57xTVW3/IHSbNy49ts702q3un8WE8YXPDILSXmkrkKE5S0EHR8bZ\nGcCIsGZ3L/tLcvnYExb7NiA1QzW9GYNKXSt1EPqaVTrlvDzQDSWHMVIuG3ZL\nWtPP\r\n=SrLX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2VUfmWxP/K4OIdwrAJ2XD+WihxY5KVChInp+QgMx8/QIgYzCC43rXuXkGgcjVwe2oMuduDwWnr+8U8QCt0AAKZpY="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.1.0_1571112770726_0.0695501184881675"},"_hasShrinkwrap":false},"0.2.0":{"name":"next-connect","version":"0.2.0","description":"The method routing and middleware layer for Next.js API Routes","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^6.2.1","nyc":"^14.1.1","supertest":"^4.0.2"},"gitHead":"9431bc49c04b2ab6d7349814812374ef1919c38a","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.2.0","_nodeVersion":"12.10.0","_npmVersion":"6.10.3","dist":{"integrity":"sha512-Mn95FTrJwXnHwGY+2rNEpleWuUXJmgzWR02VbXwiMMXnRjQkJZsFvktbhff1kZtd/GmGEk53B3DLMKm7FH0MqA==","shasum":"e9a8a6d14d4669ca3a6751d5dda38cb33c149e5b","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.2.0.tgz","fileCount":5,"unpackedSize":8293,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdqsFnCRA9TVsSAnZWagAAT8kP/iAaM4nibPHTyMMtoodU\nWLnhzPJVVJVk15gMyY5qHLF4M9xGeII6UZ7q7KvWc3KBIO4RAci45aHxA7Bz\nSQF3m3bZzlPfIJSd4Obyx33uQPNZwORRWSYXhEBxWkVJuuQlz3G0grepa996\n/gBhsE4XXR2XuyqxLRO1Dc+sCtwRPxP6kP5auEqH4El8DU4JFHPZCY4fQolM\ntsVQzUQrOD6YtMOOeqVcW33kDSMzHGQtStiAbwvwMVq5pWPw7+VxZNsX5Q6z\ntNqQa0IPe1kod3o/awK+eRXDIHMwkOEScjc9HNfnnuB7dIXdJatZfErYeO+p\nrjTINNERauB/8vD2OwCbLJMVmKBLEZ999cng33OxrJPtoAGlJMWE4cxq0l4X\njlgdWVs96nCG4dzvpJnL/uYeQx7g8ZzLZFEI0t2WKshq/HWei4h8KULoE+Vq\nIq7BTgM5a4/tVHUkUewRNTnKXwbb2VyJ97VIaOaE49UVWq/GzPv7X/UUPfiE\n/oTuIHFIehSTHfNiWKkL9eithggLJ4DyjTrVPTd+785faAIAklj1w09X55Jr\n3IleF9EOhh/wQUsauIXTUjoTD/NV5BzKd6NmhoSTOJmpwoz9LoQVztDbkv+h\nd7x0zLeQNJQApWFI4rhFKRMRoxb45ByUicAC0N1V1Y8XG81FVVgD0DH9ZDGb\naRKk\r\n=igf3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAgEyQW76r2ZoeDEaykngKCE4MFUv5NCiuAbeVKXLnVoAiEAvOPdEyjDAyeaAt0z6FWo0TJvwRk8O2s+NCxEZGwGoKM="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.2.0_1571471718325_0.8852949477950189"},"_hasShrinkwrap":false},"0.3.0":{"name":"next-connect","version":"0.3.0","description":"The method routing and middleware layer for Next.js API Routes","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^6.2.1","nyc":"^14.1.1","supertest":"^4.0.2"},"gitHead":"1e6436373254da9c993a664b56dd76050e44c58d","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.3.0","_nodeVersion":"12.11.1","_npmVersion":"6.11.3","dist":{"integrity":"sha512-4M+OCMrARKOmWcuVL47WMo+NOwjQV0SqSuZcmO+ujcI1zd3lbpm71Wm6JCZb+MMAd7eWYuXb99VjcrlQeq7hjQ==","shasum":"ff572fe77ff00a542452f8fa1dc38faf8762bf41","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.3.0.tgz","fileCount":5,"unpackedSize":9170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdskCzCRA9TVsSAnZWagAAZ64P/2F1gTTjuRwvzqtXKPpe\nde5jGqGjwnLSR4Gqpj4WWiWNk62b2kdCbc5n5HdXT0bXxaOqt1UVSmarQB2C\nAE7H62H87Zivepg1atR8Kf73wf7UWfi4CAx5VJe+GHazzIY8oBeD+iYgNlM/\nkonsxTv1o7sQY6qkQdZv8OxlO/VRPW36nkxBgnqMtjqOeTxAavmc7CnMTAI2\nCNICnTBtbJ/XZUSJ/DT6Nt5Lnz1RA4jt0CQW/QxplPqChfPRxaUlXk+ynH7V\noFabqfeItc5bG0YBwLP84cz5AfS9H9DM6vV5R9/qB3nsSzniFl3PmocFHamD\nDURwKpu8OPu8et8VzfuxzPX5Btaql37eFX0V+tDS7OmQoonZF7TwcKBXOwA+\ndmn0Cikvvu+d3FTIU7E9dwKHWGqctPrrVzYpNmLdZK8uurPqU+N4uoeBPSJO\nVksX6B3Krt3mAYMeUOguLX0hOKkevRVPy5W298gpVx8BjSvNph9x2zCegrg7\n9q5RNCmnjBdNeY8XuIgRoLOZk3szirnWn1hIgryVxkpo5B5UtJAwt7qGEAtD\n6EhVvL6ZvgmzK4yUixDiUPZXTduMNk9hMnvPGlBucbkubmCGaTbsKyorSWXv\nA3873z/Yo9dX95lgo5AnJwEL65TzcHJybTIVlEBVJmVAzHPSMWMcq+qdbrR3\n17uh\r\n=4YTG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAm+pZbBrJmjuLFQjDphhraZVGbQoKT2wxVrJCj2JthfAiAaNFh64a9kJwnvSGRUoKw/45sJLXLlO5PqmTw54s0qPA=="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.3.0_1571963059168_0.20266369470568302"},"_hasShrinkwrap":false},"0.4.0":{"name":"next-connect","version":"0.4.0","description":"The method routing and middleware layer for Next.js","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^6.2.1","nyc":"^14.1.1","supertest":"^4.0.2"},"gitHead":"b43543995c88903c3fd0a1662cdee949db99f004","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.4.0","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"integrity":"sha512-CnIVQ9mbukU4wrUzIiCrKGkQXap+KW4FH/zBLFXU/VbzVe62xXxbLUdxJf+yK91W2gkFuy9g0FFd1f03ggIKjQ==","shasum":"e5baa203a183d51d6e67dff11543802db19f8671","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.4.0.tgz","fileCount":5,"unpackedSize":9741,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdtbG0CRA9TVsSAnZWagAAsVMP/0bC9j5aQ3FSca2O0XOU\nh2j3XVB9KiNvvmB+n8LIc0xAtONOjgAlQRbkwMPEbCl8rmz+WnmrYGVvhh8i\nAbM1a0GOE61MCngIpBpphhhoXzYv3dIzFFa4+6IN60YfdjMI2qg0BR+wi2yk\nh9BmxjG3a9GZfmAtA1Gc+gBuIf+5zgH1IZ4ZV5Nae1VN4Ad/tZZtipe4RAR5\n9QiRg9CD2YRNVXL32JgDhxNChJBgTUzs7yTOu9vKePofQB7oqt2Nx0QzWLHS\nMAHTlPKD1SdGR0KkJh+42hliuMtQV1IcRyoY9FRnk7Bqpfgwzqp1aC+tNmH+\nGwruB6btPdqlvNTe0kqqYtYDHkumZIVtUe1HmW5do6pc5N5yHy/ZaEYO7T0T\nZK6SF0jUfd35sK8g3IChdI7bX7cqpqV5XqIm/dgBMTjniK3xW4WCz8oZKlNs\nGlgWB/L0abdRFOW9MwkZa0nkK+2w/MVmqzLqHeAFmnEBx0Z3FklFYlQk7Td3\nH+20PIT4HuOkSC0NNAM674hbuuRDzVvtlfbK0YupGH/X/azyrPBPIW7VfFJy\ndkQKCaGcF2/1QEXcbc+weQR4iXghhmZDnPBeGSa4sJuFf9e3oXcLhpQ7CPBh\nGuPfU58YpC4isFC5nrd5AzAm0rWJ5pcJUYcEjKu+pWOYipx83a4JdDnnruNT\nePt/\r\n=E+Ya\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAUGhQvGAFC7EpJ7i676MOqTymxlbOacAIwBoFPTLms8AiAUdAL5DA/gK7tpnD5ZhyTD/hSZ7y159pERq7TU56OAEA=="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.4.0_1572188596134_0.34912864789274756"},"_hasShrinkwrap":false},"0.5.0":{"name":"next-connect","version":"0.5.0","description":"The method routing and middleware layer for Next.js","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^6.2.1","nyc":"^14.1.1","supertest":"^4.0.2"},"gitHead":"b67aca648546e7d25a76ab2722771090a58f8fc2","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.5.0","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"integrity":"sha512-K7E9czX5l5ha8iGdasah28lp6vRXhaBN/Yn1+p1LUONyoop/ZISCAzZ1GF7DFAYfW7Nw49TWhzBbn9lxsXzHKA==","shasum":"d0b5d659977fe32ec91b9b57e4ce02314800a430","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.5.0.tgz","fileCount":5,"unpackedSize":9947,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdw6PlCRA9TVsSAnZWagAA6awP/10fzbYNHMlpgn1M0TDi\nyYnFLlgm7G37/FAD9iG63/uvmrseasTi9k4X1yrGULxPoKKtMFGI/qHlpzWs\n9nBAbrIqK0kZFrX7Pj0T1tIrlQ3EavIaE5sQc1TI5y+uF7mUlsioKPu/VV1e\nC8JH+bl9PZ6o6grk+s7b/ivE4UTJ0EDCLAKWbbX1zsa8lYWdyPQW+DyHqdlF\nZ0DbqfosN/76hLHSugJimIqNh5IWmEqfWf3buss1T6gkIMXYi/PNruRexTbi\nc+OoP+3R8wS/ZRKrmgNtBlWU+57/ZsnflQy9997PJb7zYuH8aDp2Y4+dpPZF\nniW/8LhkvAsNp6cZ25t4oQngQRbSRd0bkFDerhX5ftUVOLzEDBop44+uroTd\na9qnauliVcsqqN8CzmgGf+sZZwVIpJP2pJMm3ulSrBNdDZkb23hI4+se5UyB\nl7KTQt+GI8zEIoHx6jC8ASv1oRTIm8ORVXn/CDhDi+NhITnST9dN3IM/P3Tw\n/DY1Y99pCLKnVUf/SeunoSHdPkLImQ/ducB8uOl1tSfr8TUQa0oH/etzgq7h\nkBkEwVoqEGfercY6jESGyICtJz5iquSE8iIQsURdMlmW30AincxF3XIOAA06\ny8cybQhGMWQkPfuMFzhRl0LWxlfU9mjlZNh/ULhiMhxpK49CBH73IvgwaaTE\n/uxM\r\n=ou1c\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDuXV5BjcWcJz9dd1jmEM89UZcqnZENaB2zji9eT3a03AiEA8YJNrfpKa3PzLe5lWJeHE8h8ErJdK2yI9/oxRsjFg9s="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.5.0_1573102564451_0.26870984941996445"},"_hasShrinkwrap":false},"0.5.1":{"name":"next-connect","version":"0.5.1","description":"The method routing and middleware layer for Next.js","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^6.2.1","nyc":"^14.1.1","supertest":"^4.0.2"},"gitHead":"be6c774ef68421be15f368d1cea11e09c2c9b45c","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.5.1","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"integrity":"sha512-1i+clpDnW17E6kL81bvChKEWNXJHiLESDlkA/wlu/uqmpeFyOB9iAF/9jc1kcXgP0W0cXYb+9IDGmFE7O4r/7w==","shasum":"eef279cce9df0b85ea52d2401db0317f8a96beb6","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.5.1.tgz","fileCount":5,"unpackedSize":10190,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0JacCRA9TVsSAnZWagAAbpoQAJuilTd2tq1Dshefs1v2\njEG0oP9EsndPGDE6BkxM3HsFZ/YzDAxP/PmgIFdwsPT1AwrmgxOXCa5ofTfN\nPLILVvRQIyOiBhv3jc0aEU7iMIKOdwlMZAFc1yhKZvdrdfjkjIVyg0eSOaSu\naF13FAVJjxhwSr7OY01H31TsHYlMcoFhgoCG+Lq+zr/NImV7HEyN1Y/GvKpy\n5Sll6SaFU+ShNos/6anH5D3hlkr+WQw7QlO8uShVakJimtKgpEURcOIemzj0\n+Q8h8gfvsGq3erE1P806d83jlan5Nkubl4pQwMDeVAGGV86cJzOD8ELqG6RM\niO25vrA0GpclZLCgtWx2Dc/7+v0RtmNCzjbWEQM1KKzPWWKGBPDRfHPhK2N2\nsVvxba8gi5mG3mOLWMS+yIEPQE7YMk/In0tG80S+kMZUI61403+MN03WaHBL\nMU8xm/bTajdV/j/lutMbWeTM6jk9CkbJoJE/P4QFvU3B18hhntMpI6Dya4Yk\njl6gsKLB7qK398lwVSf6UxIdYhwnYNep05NaWCFMY06Hev33qsVFoCb3KhOa\ntCZfkAgJ4xgTC3iZXBgRYLCctarZ1QpRAueFyOUsPBJp8yO1/u+xlGks6S40\npP5okwTY0kFwfcIAwzYjzXxCY/0vX73dlC2r/xXgUHCQAGiV1dhUQkkdEXx6\nLr6Q\r\n=5s0v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH86Wl7oLifBC0CPVf3EGwbYWeqWcqsoDlMQfB7Fp2gnAiA6JsNnVEANFj7PXicZUqYQQYohtRt7xWiPaQEGGgxfuQ=="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.5.1_1573951131629_0.40523156741029775"},"_hasShrinkwrap":false},"0.5.2":{"name":"next-connect","version":"0.5.2","description":"The method routing and middleware layer for Next.js","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^7.0.0","nyc":"^15.0.0","supertest":"^4.0.2"},"gitHead":"f8172502757bac6fb70549e1860d6816bb633f26","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.5.2","_nodeVersion":"12.14.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-zCDQk4sLq6a5kFddJnsE373loDAj/cWWSCnCYgilKUGUprjx5XbYAhntHAPnhCdQwhkbE5+HMS8SKCdWOE/UAQ==","shasum":"755de920be9c339d3ee335162487106b06431290","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.5.2.tgz","fileCount":5,"unpackedSize":10240,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeFrEACRA9TVsSAnZWagAAcaEP+gK5NA006umu9qhKHs2C\nbYatcCqUWjOHFcLL775bYgizVk3iMlPZVA/CmMmz8RhpxN0UeWS2j3NXjEVB\nk8+a39b1gFvkOU2ZrerC8wB+YtIvq2n7Qcgx0rZHNrz1Upsz3uctiVllF0ef\nkEdBNR1i6dyAS154aub6WxXyZmOdJoodtzAJnQxICyThHr+yrPLfNtuDclBF\npP30LBNb23UAXOWxkQr9Bx+wxzePg7hz0nuSYi7ZjxYo5dgY6Y2KHoLeNw0R\n2BmfYkbhI7+jzEugrWXrbHjQt46086GqM6zMxObckPFJXwisAFjxBLHvNOCk\nbuFAhQ6HFq/qaW3yr/FrdRGjjEp/ox+y2n3V6J3JAItgh6+OPkebUe5ZE7nQ\neLvOe/416Cn58aq8oPB4echt5vaB8lJjvQDq5Dwn8BorJZU1Jx5/JZhPf6Yb\nVX7bKYU3cap4usdS8dL0//AfL+O1fs0IiIFypL9nltu/ftepjuRpQAwcsPDE\nv5ASBdA/+acXfLS5pqH8Qel4lHY7sJTc3SqXtKNElYFI5Autl9kaa94kuDz+\nWW0WleGrTef+mw5x0jMCsQOsuwOSCOQk+QYhGtUqSVHtsspcv2x8kBKk6yAY\nGF7sVX/gdGBO0yVGK3SulB+ZDECn5bs0CO2g23LAxeD+laqaRmA0/ITYgrYp\nej0A\r\n=XKUv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDduqJA4rj9j6a/YMYP7mLsMTccDsNJRxGKyHKQS26dyQIgTmKp4+0Rl8VMABOqfjJZsLCF7HRCxuW5Sp+iHvxE7C4="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.5.2_1578545408177_0.941839449148737"},"_hasShrinkwrap":false},"0.6.0":{"name":"next-connect","version":"0.6.0","description":"The method routing and middleware layer for Next.js","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+ssh://git@github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^7.0.0","nyc":"^15.0.0","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"gitHead":"ebffc717837c449b0cd1e24d3025ae40dd03a73f","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","_id":"next-connect@0.6.0","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-21rIe1gNuNW49d03YaxqQNEs8LlFyozsL2u5lBR0miPkelTA1yTewyTFHGhIi89ZNgQJt2x/GhFHxVIqkjECvA==","shasum":"5deb6ceca27da2a6dcd817d972f23cf764bc6963","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.6.0.tgz","fileCount":5,"unpackedSize":9103,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeIq+RCRA9TVsSAnZWagAA63sP/2vYYP79XrbVb1xkKWhM\n71QyAyvL+eJArj8kM4cm7PZ4+hTZo1NokEAdEaXB5mZ4f88Fe8FsOEuxwXWf\nge4OSNk0GOFMHsIgzIdOzTtTJ73iX68BvYxG1QfKa5+VreQyWWDCLuCTCiKg\ndnPedUYmv0MwzAn2fDSbwonAGibSrv0EC6DPlNvrG/A0kcP6sxNPVVyN4hXh\nGA8beuFX16HSNvEGFiueSMIuuxZkbrTvS1MgOEMTUZJfr0rsBawOwjlWBEDS\nUmZXin6n2stqlC2d4PGu7vFDM8svS735QawPIXKAjtCCDnYL3ziOBGTeJEam\n9f7X/apRxkehoQ4YRtVpX9ccj1yZ1XVKr/uZucy5PUmCVHXT5CfucOCqeWoP\nTnMc/gCjIBn/JdMERFRFJvKFYGomEPEOJDDNVzJCJBkE3FCtQzJhm4Zi7TWZ\nQXRi8YM0E+ndywmX/Vl7WFv2K9uNwVnVhr+h3X5LJt6qkJjtXNkhNWj7ML+J\nPqcCBBV0stpZ9KsNI3e1A/+DLk1y/tVP4TSuIUa9w8J2a2V0ohh94lCj1SQ8\nNutZ5+lFsb/mLgl7MunH3VTCIehbGxC/4FEcpUkZlzeu1ok1BQaiDlC4a/8Y\nWRzuouwMtMzQR891KxF7aJ7vjaaFtOy8EOf152PPFKTHokv/IG6AtAf7O9f+\nQFAK\r\n=vC7T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxWpVdclW3KwzWal1wOdu1asOCgl/qyXC5VPHXwYS2DwIgalpCD2o/Sw4YPDdtD0KdYSoAkZFuaqy/sKtYJV/6HcA="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.6.0_1579331472604_0.8973250699728714"},"_hasShrinkwrap":false},"0.6.1":{"name":"next-connect","version":"0.6.1","description":"The method routing and middleware layer for Next.js","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git@github.com:hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","mocha":"^7.0.0","nyc":"^15.0.0","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.6.1","dist":{"shasum":"8604f959a969beeb6c9b73eeb9cac42e45db0778","integrity":"sha512-sHSp7JHaRgLaod426e5f8Run9j5/0IHVst97cVQ5FcHd/dTtYqfsL3O62RoLSHJVJ8ap5zPVhOGY+Dor34LCDw==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.6.1.tgz","fileCount":7,"unpackedSize":10205,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJee826CRA9TVsSAnZWagAAVr4P/09a8kJz/VHV422Wkw/V\n3K/k+NejD5zkYQ6mlNIowptOqVKZQ+t2lfhI4LWvZmckB15cbzBLQByRmSei\naVI4loJHyWmErKtwVhexeH8AgIx/qW2KtXTSRvl1ltIdWpAHjQJRGLNHDVRK\nb63YghrWvnGrwLP53xdy+MBCmMljryk4MCWZzOrfmQrgDR8QqxZahXRENOin\n3Exsq1NYMzU674VQFPAdiE0fb6LtcnZ2Ww8IaTu8g5x1NTuqBxcqx7/5RfWq\nNLJ1mEWw1m9FbzbvkX4JvH3mGY38TTKURJV5qzIws8HtgOwpcpgtybG/iEhe\nEvhnPtIywev/KmiYXOslauJnH/7mc7wRXrPlaI/52XmbwqiGCz4Fmen6VwfH\n354f6qM0yiTftgha/ANaot/WhBlb30wNFuzfMgmYcFWECVjf55jaLqa7YCtU\n6fPcJq2eU67osPXFO6mmOrlrH8QZ6gFVswrkd9pcZzGsz477nEkeW8aXOpI1\nFT8L0maMe1IUbsBvGtf8Yh6rqjz7sfglOJmKJLpzKcVtBALs4annw0646Qrv\nLBE7Q+o3AvSGwlDrvdSLxhNEl/u8VmXSMPaRhuNqiUi3jY2ElUga1fWWbiWz\nGD+FfvQ+/ch27sinxQsPx/7/C+42p9RUIhxK5hD646mUlSayWEs2xWKk7ZQ1\nBJVD\r\n=UEcn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1Gys/Q21Y2k74mrLECR44HYj1CoYfJySRQsVAzikwXQIgEtNKA0Y1r5TlVdEkESLoaJhhXs01HTL2Hv7eqVtXxb0="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.6.1_1585171897553_0.5266600395132957"},"_hasShrinkwrap":false},"0.6.2":{"name":"next-connect","version":"0.6.2","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git@github.com:hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.20.2","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.6.2","dist":{"shasum":"67bae68938955399178134449ff3c95772ebc891","integrity":"sha512-e7aKvQPw8rATUNcYY6wjGxF4AsZS3s30V+tmWA60DuaCfXa/RP/Jpl6EdAscEOijFjRBgcgb8VmcqB2AQGuXQg==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.6.2.tgz","fileCount":7,"unpackedSize":11064,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJelG3yCRA9TVsSAnZWagAAtnMP/R4N2C3IiqG7JMD+RpZ7\nygRXf40miOI7vb/+SrGQVuEtWdolbwQSszZ0b6r8464p6Aw36i0VH3xyP14J\nhC6NEEvOG6M/nDqUUHbx1xF5nGgTv2SOXSqEZCXsoqBAlIrnXOs4/bhot3W2\nrovf4dbyaTf5VhS57wgBtduFpDZ8eGc3S59l1RO4Cpw7+DcmMsVMoNUUiHb9\n2UcBpulUEWwoLzuYEdMn0wYwbQrw9rRjKFj3iqAE8I8WRd7JS2s15QPCqLFQ\nKCUmx+f7C95L8bDFq6PheHl0ATeZHh5J3dO8rQayD5lcG67frKSdbJkSyGsj\n+FcjNDDHQgWEYSvOdqVJhmoUHMcDNHM0qg1oN9Qp0LtetWPEwiOKsRpXluK3\nULo3SnIU4FG1Hkeo05kkzOMsyWWUSeXUnEP5e/hCSA4MiBwEckfRIOneMKW0\nOMTOzup3z60WONrNOqr+dWRJhp5socnXQR346GZLi8sy7+hRnVIwcGcLvcyU\nyNo0BxaztDT5QtRhcYD+vNFvRLQJF27MBiv3rnOuQh27cKMFSIHxkEuqWm2J\n8BPT9WovQloNszO7pD1D5DYfxYtyHSvpc43GV57Tu7MnVt81txRR6ao3pAZe\n3BS4L2VBFqx5NuvfAeOM64DNt4PJZuv2o7+yP572zRMgs34drVJxnyDXEnIY\nu8WD\r\n=Wevz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICy7B9idG0RMBaN6M8GYZOWhC6269Ev5ndNK8IixXWYyAiEAykCUOObjNJ2vTpo7+MqAqJdJ0XZ5bjQqqglaoEh0Huc="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.6.2_1586785778329_0.8970215738493121"},"_hasShrinkwrap":false},"0.6.3":{"name":"next-connect","version":"0.6.3","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git@github.com:hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","devDependencies":{"eslint":"^6.8.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.6.3","dist":{"shasum":"2df6d835c7af20f61925d5436d5c44d213c0ab31","integrity":"sha512-Li74PPW/JlZERBGT74eAPf5qSWZH+CHe4yODXAquCauxKzxfR7PuLDf8FOT4VW3Bygf/7axdi8Li22AR38IJOA==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.6.3.tgz","fileCount":7,"unpackedSize":10816,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJelI0wCRA9TVsSAnZWagAAfFYP/j4sdIkhS5pdeXVqFIFt\ncvdeqPJ67KIZUxsT6SvOlBlNBO9RztulRMRN4VyaMm1WOYuHVKOii5C57dPP\nfz/espzP+y+Ve3QQO8PrJddXrtUWXbeAcODCcsGZ9ZaHk2VdwcUL6xpyueU8\nl3OkUPY8qkXGe72Vq0C6zYunwx9meD9IEjm2kFoIlIbk405NW0tzAJoK1wkv\n0qaZFM8omXCuFw32wpbYe/Q98l1zfmw4I3oeDxTX5TJ+d6P2zmeDyPwYKs2C\nzD1f0OaLbTOGNPJUOVc5A8OE8KR6s+ehTcb2S0qQ89LT5z0cwTsyvL/lOmc5\necJMzSpXXCXSt1V6J70Wu4GsvxbZL9/lxkhpKyVpKqw/wTf/53P+bR+MPksw\naTWP3OoxQNvuFxbuFXmFfO8OhXlBMxuMMEINYmxX4Qk3sHDTERNcVcq9Cpm6\nyhPEe5D1ZPj4sGuMhLS7K5MK4OWxooonHulz9uMwv9im6MpE3nOHW0BAG9EC\n1Q+KY+ezK4gXpoxCdSDsP+OTb3y49OTmSNye9TeMjMXp4LwyVXKAoQoBU/9K\nKah/tpukI7DIIQMgWuM0lRXLObY5KOBknHLZ8Sfwaxl9HqIUVUxASN+OBRlN\nPLP1u3Ordx/OeXHos17iE2PfW/iJHI8X8X8eRxJ1BYy4iAu0491+lTb2i5Jz\nezkC\r\n=Sexy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEjetmPFVX49fSnITdkxrxlJL+wIdD80FKe7bbypioH7AiAJcJJdnTUrg2NQYdJOGqJoWsdVKwsZ8j3BszgrFN2ELw=="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.6.3_1586793776140_0.47937764143767403"},"_hasShrinkwrap":false},"0.6.4":{"name":"next-connect","version":"0.6.4","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"eslint":"^6.8.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.6.4","dist":{"shasum":"34638c8d65c287f11403c028500170d04c5abbb5","integrity":"sha512-6RsPyNS/DJLUt0fwwpuXqLK2odsGbFylzXOptZCcRRglu07j2d6eTUhYkEVkhx3JHyUl4PNefIEBSh/jn97NAA==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.6.4.tgz","fileCount":8,"unpackedSize":13186,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJem4ozCRA9TVsSAnZWagAAOAUQAJGGvE0NJS7qmowE8Ki7\nFyHecN5QFUigtlRnV5NW0NrspqEwZQgnGmM0MTwessnfaams7o9ElvUBIt+n\nra6/JwtfohWYdDTdMfxk2UWs8dwMPFVajQPkx7likEnznC0/Eu1Kbn//Rr0w\n7AIcEgxLkaMsoBjeW/x4JGJ5xvgb3lGOu7fRIBP3cnvASaiztpe5Wso81pfN\nrF/gpt/YMLxjIRgH5gKdy8v/mVL6bx69HHgfDWI2OgIhxKcMnE+Rq+oki4Fk\n7zRTmXgeepTgA6ElkgrLntleErZiNhITiu41Pu/fQvZreMMEwYRBX1GHLeLT\nhPnbuXEf7RIFlakSyd+KcgYv4N++j+PVmo9PB780VO70T3dgDS3rsFOLDZgh\n//QyHNHxf0E3oJ9VVOa4dYFqE0LY9ZWd9mU741j6IEQfEnyj2f7VSt4bbIYC\n1+cWCOsAbqbRdr5wB5Y3XETbAwP8lRD7tcMLKGMWGOfrN8a2v+8+I6d7vjkk\nBY81hF8WZJht5dlZ5414wPDzMen5r4V8TTQxXuUxNH6ZFOqzQqeL7V2rVCZ3\np8c0KIcHcuYy8lLrs83IkzxvT+Cf99a/m7ZBgLpvJBAzAjYjekQDAxOwKvJL\nT3NoXIqtQ7ryZmZPDLAFk9sh0kCi2gWI9RURkDmk3UnYpoxXUDl7nfgu15+p\n+lZh\r\n=PRYv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGj8T+OFUM/Kjm3RTFLG/WqNgwN42s+DkOOhYK3esjLhAiEAhMGlGJHKYoQ9ZSy2o9Fyux/KWPpRKTjCBEEzAobKdDk="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.6.4_1587251762741_0.17429545824171178"},"_hasShrinkwrap":false},"0.6.5":{"name":"next-connect","version":"0.6.5","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"eslint":"^6.8.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.6.5","dist":{"shasum":"36dc4d706349e82672b32082a94e2494594ed448","integrity":"sha512-4o3wy8+g6JIwxmLODDtcAn9Q3yGwuPsbjZVr7kx7IADAl3mtd4b3iLn7dp8mGKl+JhD/tP7Ike706nsVlFbWcw==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.6.5.tgz","fileCount":8,"unpackedSize":13399,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeozvcCRA9TVsSAnZWagAAf1UQAI+0gu2hOWeKGAceYifc\n0QA/olN7MDeoN/QaMwyvnpchvSjBPzF6Tv4XYTAyiIGcWjjzWwMDelP/Mwb5\nKZ9DgaS7J+FRzy6CbL0Yu4v5i7GqtM3rlvqxSLZ6iOFryXlrhVoOEH7TLZLS\n7sfI+aH/qLM+JfhKOYQqMI+mUn+qOycyds4jjCvSsGJbYdhCASXkdiT62VIP\n3nQXnvZw7XrzlmCtML++ojw6Tikcd7/w/DvfPo+VZ2195ykRnKYcvwR1Fi/e\nDhNWkPkwAE6jEKsEMFeUHfBl9wjYnvkfKRuXzEuPwzPVmHfltyy7H91jIsrA\nPk8PO6GOoFNju8V54k0fLeJC2DQwNETMe3yIJo6H8vUa1nlwZ9cfrVPXABar\nJ0PBcpLiNWaRg0j37NL2GUCiGOdr5wqqJuin7O0a7aNQ0AZMYN6J6goYj+c2\neAEDEbne1cYK8iDfrqv5mcWPWvWOZSGk9U9AgKkwdbf0goP9TODymcoyeVOo\nha4KELt7RqMtUWp/q4JpYtXxZO/lW73C08M07vbItKMZ/nKre+dy+rwLYufK\neUJylSyo6ll0op/yGM15EjI4lRzI5I6cDwFxWo2LI6zSY3Ka0sEmfbOuMHdP\nnZgY4rznZ/j2GEkYtMtq48tB/09ymoNuR7N9JgRX9KDh1UK3L5llUXrkbCYT\nZ7wn\r\n=qL8p\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBOkcdXaMVhLO+Q1TlMdV0UnEscV9wc7rgxh3D8+qHFWAiEA2LF+Q9eGJeQz3InAwZf37Nl26cyQc+1QqOnErJlrKuQ="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.6.5_1587755995531_0.439035706093059"},"_hasShrinkwrap":false},"0.6.6":{"name":"next-connect","version":"0.6.6","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"eslint":"^6.8.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.6.6","dist":{"shasum":"baade099a79b691de6b8866c9ec7841ca5881224","integrity":"sha512-LsDQxm+zl0qqyI15bxkhbjlpsrlrLhfQTxVtkoKF4qxB3KLTxAICE5kmbzhaMpJAQwSCgJbhzooLrHfpESmu2Q==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.6.6.tgz","fileCount":8,"unpackedSize":13518,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJetLN7CRA9TVsSAnZWagAAQc8P/Aq7Kyit33Seyk2Gwero\nDRqAibOtneSegRehLTiyHje+aqubuAHbF/mQ6Qp3wFHKYPzl80xY0bHtm34o\nWBzES1y23S3vp0dETemgZYb61pfYf/9ZCG/RzHTS4CJXxZceoLRyXXKx8cDD\nvCzOXXDJepzaDmn/DQ9eXHnBSbaPgwSvoLEZFLOkygfTNaJOmrmlCco8doUc\nb6ehQyeDt0qTbB9Y07kmZCoxwwRWdOnyvoFxsq0lbEyMXIi016M5dtiCxlDS\nnTyfDZBBnbQm+L40obOnMAnZJIgR6cJE3vYauEkglTMs5k4DHsWjcIhYAWsE\nbkcq8Jy0mYy9ZrxkLaczBI+ker6nxJe74GWGvhQ7fYSUvl2sc7llt2era22M\n0Ge0VcM9dOFGfNdyJVRJiUhNQWP2A9FtvkEqhUVk3/LIujS8JiLE30FflpaV\nBom03GnKozj9S2cg1hLaViePzhim981rgwVCUwU9mHIiA8Kt7CgCgxb2+PQo\ncCyDT/jABz7qzCS5zG6Xbh6dPFEnkFyEQ6ck6VyL4z70CL5y2PhoiRDbTGQa\nkJ9cOGlSS0apE05eDnj26wuV9O8CawCM2Xg90sut634sbcKIVwyfQwxLLni4\ncXU59dQ2aDLjRuk20lIf+32ps20MUiMJRFFh0X1KIC71DUsArdnhRDD3xwef\nzhhv\r\n=EtkU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3+Que10dbk5fLWvKMptH/Fjmhu0h8ZL73yKVS7EB2jQIgaR3h5pz0pp/Tw/byl5XD9tXT7TjG4No6eHRjTTJ3MXg="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.6.6_1588900730475_0.8304672292694015"},"_hasShrinkwrap":false},"0.7.0":{"name":"next-connect","version":"0.7.0","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"eslint":"^6.8.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.7.0","dist":{"shasum":"4dd4c7ce7e5f83ae4e56a1bd39bdfc06db737407","integrity":"sha512-wiLg7REMk8/o4CFJ01kXKtKEZykIEitSgdctQhquZ26jTQAn9BGLxVNbJW/8FpyTuh0vdXtWLGz8aBdlMVfN9g==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.7.0.tgz","fileCount":8,"unpackedSize":14562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe2Fq0CRA9TVsSAnZWagAAVh4P/RqmOlGMq1+WaMoqXVi6\ng9m+jPCBF2hC8Mv4MZouy6FumDEbd/j/qeTdiWep5on9sUmg42vcRM105u9v\nF6pVYpMODDkncW8xX920iJaZfdk0DVS7OiJ6bbkqe4Kyaf3G3NJJZ0COD2It\n/1c9pfICbxkhyCHYP3JK55ap+oPxCpvDhDHPomakiKyRnauDA/sWiCclJBXX\nsYfctynZTdFrmUfFZe8dq9iBc2LhAGrgfqzjGt+rrtvb/7hH3V7usCZBi+rm\ng38uON6UIdd3OWLfTYQBuJWW4+/0tzV4g3HKLFLEoaVBxOx2bzyj7Fx2MlQE\nHxluXIgWYo/Dud3On/5b/ls7B+Y+4b6dEDvHqzxrGy8w5mzz8Wj39TmkURhR\n32ApRwAlz3Ygi4mSqXugVxuZNEVMZl1JMIA/3ZjVHmXvBtcLiZUaARusT+Qo\njd/RO9Pj/Q8gbbFvyVGyM3iVUO+5QbHoDqdtAX4RxTOdGPyejAyLOxL5b12W\n54dYFcWTqBjy1bjnivR77arMZs+rjqxmEih9eLXv8epvlm3kThxFxrxiR2gg\n1J2M/ywQRYbIGKymDOlwonZ45NzShhfwfvNSAOODUKaiEosdcvlF4mMNBeuf\npJSjXKSslAHQzTJgOD+9cPUOFIo249OVoVr4Rkv5VIYPMg+R7L1LavTiUOJ+\n1XWE\r\n=uaF6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCG3Zf5wNcHuwxyR5RplK9WTu2GkdZfsJjOv/tCNbrz5AIhAKEqkzfaAJrNba3ndenZFdgbYrFyFNxg0TybMColjbCF"}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.7.0_1591237299479_0.7461321684366813"},"_hasShrinkwrap":false},"0.7.1":{"name":"next-connect","version":"0.7.1","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"eslint":"^6.8.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.7.1","dist":{"shasum":"c62bb466d924585f1b5fc39e4828672e2bc66007","integrity":"sha512-EQ4BIlEEpQyneRXrPGAGBHMGK9kghKEPcvWWZWO1Vzn1TJP16YLw+8y0qtT54/x/FlD0dC0AQCwZydKWqqAQBQ==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.7.1.tgz","fileCount":8,"unpackedSize":14718,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe3ndzCRA9TVsSAnZWagAAJocP/3p2dC3sSE6lAvEFyd3Q\nonKuRlu7FM9N3UTobjWpy5NE777Oge9PHFmtG+mClXIKbir+Q+q3gpPhNAGV\n5/LegqNdiHsDhRF/8Cnz3iWK8aUKExjJ0YjnsODDLOWopYav6Lng8ENZmrrl\nboVx+wkZ6hTwPBAV5Qmwf+M/7/o4y21ttlyNkW0eSmTXMnY7/aaZypvhOboO\nUWAWxUUzLUWhVRRN54ISuFDLEnianpVSegD7HCGGvmKSBOg2f4NAMYVZ26rg\nKHH4r+Q03QhORYnEfbA1mvkJ44cDYvfolGrLK3uED63j4jbccJN7tJDwfbHl\n+WoBvOQ6a3P5j/WL7iATCHdSQNe1rtPzlzF3LHwv5H0/WR4GM45SjDTkVUai\nhTywjGUiuGE0y0NPx7zi4tP4OMZnem3NnXiixtngHUIguKQ0+Z5DfoKpIE/V\n7fPjfJTFfmfmKCE/xkA0Z/WWxV2xxk+jVIe0cDWIW+qNw/W2URfNQKDRykrT\nljF0UOizTCEvPAWA8W8tFuvbv0UX54nZeoDF/dh/fTbrZGXEiwrw4roqBczt\nkuIMm3+oQiUe0Ybqla73xL+4gsGFxzJJTURT/XzMJvPfS3hpx++ZSno7D49a\nxhtTj21ZOXtO2qugWd4S2SKHn+ec1tfh7eOfouD+nO9i3PS4SM5nSWvTTM6C\ncWrS\r\n=Q93E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBymJCKhyock6E4+udfJKbyFjEBMPRwx98qy18dUHpfNAiBfKMGR/5Y8Y4pCqxlddWKD4N0ywrYhslsUVX3jzETPoQ=="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.7.1_1591637874745_0.15848612064132994"},"_hasShrinkwrap":false},"0.7.2":{"name":"next-connect","version":"0.7.2","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"eslint":"^7.2.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"@types/node":"^14.0.14","trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.7.2","dist":{"shasum":"1cad82eacc708caa82f0df3379511318bab4d0eb","integrity":"sha512-gLqkfc5rpG2w5rTD72FMKev2YI4mubMe8OHtddv3izS5v3atCcSSsOsPckm//8C8tFnq0XIYXx5AxdRObiCEtw==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.7.2.tgz","fileCount":8,"unpackedSize":14666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9VAWCRA9TVsSAnZWagAAku0P/0eysP6gyUrSfrvh6AI7\nb37U7suRcyph4Tv1/jChGFOAU31IM3oNkWTzHGo2QQ403oEG/82YoI98RH/h\nFFVzJQJTmfhahrbPSrIG8s6uWSgltTgUyZy+GL3XjW8GALjF/CeGtw5ZTcAd\nIW+yln91Da+Mo+Iclm2I0bYiNMvQCJxtefrG3+JB17jHGYgD33horR2K60B1\n0OFNntNr5Jrh8NjQKkdtRme+mIwzXXt7D2bu6n6YFwzcE9137rpU9MAAQ+tZ\nmpygEhOEUHHiXcyfAYBDvpcplCrgTg5p/yKJ97mbLAmnoXHemXLDpIpEa/Fn\nM4gkk7dAQ0cNPnYPgijWF2bhgUZvec9c5WI/JIEutJFwDWl3QoFLsylM27tx\nLcIVwcGPns23/pI/E4XxmT4vvlSF5ANWSGB9p5Bny3fI9taBad93RLoZ3Zk7\nx2EyG4T3vJflM/owtbcXiTNOy1SjjxWex7J4wtx9YyP9tECh9LbZ9bCf2pzb\nd91OEx8nV653UOYdAjtsDW20wyKauUlLLKFaqrXXRQAEZ86tMhvjH6a1TK47\nWWvf6CHDsGAqGRX8Pw6e2wUSG7Hf+pr0Hu5+7aoMouy4k4nhhkr/AQvdqp8O\nU8MFAGRSmUzaM0H253mVKYWWsC1/ah74d9Rvc/6kFo93u7dqUYy9JgB7b9/d\nCP2j\r\n=dmyG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCT2RxHgOfGTtD3c26ws6I83LpgIq528mfC4TQ2oacSoAIgQ13Fios5U/Ef0cpFsUfca1/JgdFs/mqxHVt8v/JdC3E="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.7.2_1593135126395_0.49325841456970654"},"_hasShrinkwrap":false},"0.8.0":{"name":"next-connect","version":"0.8.0","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"eslint":"^7.2.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"@types/node":"^14.0.14","trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.8.0","dist":{"shasum":"4297c73a346c914d399a00fedd39e7d25852876f","integrity":"sha512-00KzHiPc5LsOmWV9PoNkCv57YesV09KDINdF9yTBuTSl6xKI16otMoBEl2vzDoQ9BrNdtpHtq0ID1Rr30NCR4Q==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.8.0.tgz","fileCount":8,"unpackedSize":15560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe/DQ5CRA9TVsSAnZWagAAmUEP/jsNOzxa2fQ15uVDIhJk\nxgxAF6Bbo5PD5JiLSsAOVUTy4eEHdgARX5i39C/ZeYWxsb/CPndJzQ/6iaEL\nRx9AqMah6P2KVb5fpzFQAYzEjUXx5B63kN07E9CN/m4pBW4RfdOjD0o6Ty2c\nMMEfBdsFSU90UFKGiM+/te4uTKTaAc5DUncFX/TpzprCJmOnADLwftiLv4CD\n42QgMG0q7M/XxcZV0I0z0Z6mTSV0tyyYgsRn3z73RuCIm657s05TnOn8qihn\nW9H4bgBI5F4cu3JdeGA3atNCVP7FSLOkgf9JiMCcZMQtVPcLm8bdldBMe+IK\nRDDBEnmJvmm4NTbG3qMgsS+TEQ96BprryW3BAyzNshN+iHMUxDS1ytfO4u/G\n0fj9sud2Dh8tnxpi1LGrTfhcLokwforOumIXFhqHqH6Hl7FBMByO7s2B01LN\n8IL27ugStsuPPhGaRAA30s7+o5IdqgRM0bXpCscy89Ks8fHKsA2bfdXd1Gmo\nbbbuI3KrHPxAvETKTq7AsXoTKB+rnh9ZCVW4IKqeCYIszY0xZjxvnhGNtmDt\nyPUxHrz520FuhN6wlo1dY9yAnDkWSXN8WQcDU6fOuwIn9IDvhfqm4a5a/A3Y\nyjaUNEkW7UC53V5S2L1tKAl4H2bBnBgwCs/PHMqCGMidIDb/1/UZhqv+ccwY\nNDdb\r\n=eEXb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGZx8CTZqDAPiXBF/mOsqaPM99jMOzYP1P22O5rrvzg4AiApavoJHgF2LhQqtuT5DCztOODsxGPcXibADyEtrqRGKQ=="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.8.0_1593586745301_0.7679485392993748"},"_hasShrinkwrap":false},"0.8.1":{"name":"next-connect","version":"0.8.1","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"eslint":"^7.2.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"@types/node":"^14.0.14","trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.8.1","dist":{"shasum":"def20d9045fb8043855a92a3bae40d88ef3f9d3b","integrity":"sha512-V5O45OV6+neCb/iXfPUpfcFirSJ4czr02+Xay7TyW/8Ybq9KzDLPWpU36lkvPbwNhpdxRXAi/j907c8MIURMww==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.8.1.tgz","fileCount":8,"unpackedSize":16001,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfAtomCRA9TVsSAnZWagAASMwP/R/LVl36gxny5oz8ZW89\nI9bYnbem9zLiLp0DXQ77wMfABFH2Ky/W0fLtZsn8UyjryAFSt8iJKbuLgkoV\nnbmTRk4BF7LI7E2y5N1IstR4WcHzvtpaPKSWGkSVFkKRZNxOuBbROLnELvGB\ncV8LC9Bko1tPymNaXwp9WdKFY8A5yBwxT9LgUpzrCMDmSt1TNob761K+4fqa\nEk7BnuzWTh5RmCap/DD1+QbA6y/3jqIynG2LtnRr2SVq+nHgMFLFbtrVktlI\nvwRoLyCm72AbyTLNSdt8YQWQ3Di9bBntjDsezuL4Oy4r6uB/tPeI5Jxdgjw7\npmaTVamAgLQ78Hy2IrG6mVGIJLPQ4TwtUxSA62Idcp+O8wF/uiqjwSl/wgq5\ntJYim0hpAfjEAiHg4xvsPlcdWhKDlewkCRyoobA9y7zt6fSZPghZrrHXE78Q\nsqEA9LOXL5MoaH3qNU+ii0hKh94gWo9fpju/lSYe7xiBZpyiH7ELX5Z85Yul\nXw9KifYYLvBvYtC3yUZqO1Xot7orn+4xxpv8LsKaB0q9OROn4hlsrijqpxLb\n/zXgkBUn4gX5i4a6Og8VnUN8B4OgqGbituq9zKqfmo2PBnAIKpnuxl+Tmy+a\np+CRJcHeRIdf8AfNf/Lst8fdLtRig7Y9DunFUe9ARwLJB1QZu99p84QZWgPE\nxQp3\r\n=eu7t\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDPXsrMjb6jCxYV3ovjdBf/oXQrOfQnMQAYG0hG3BL9vAiEApD5tLGx6xyW0m/24dg6ezq+IOI25tToMFs6cKXkm23g="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.8.1_1594022437343_0.16483817320968952"},"_hasShrinkwrap":false},"0.9.0":{"name":"next-connect","version":"0.9.0","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^14.6.4","eslint":"^7.2.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.9.0","dist":{"shasum":"d110cf177decebbfb3b36eff5deb1496de40bf29","integrity":"sha512-fuWVJNTCYXG0wbzHFuf1vYUr8BFUAa5+jbaOzTQpN9lyIeZbww7EM/bZeOUlgd8C/A78SKa+f/GEwPK063zhsQ==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.9.0.tgz","fileCount":8,"unpackedSize":16477,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfU9iDCRA9TVsSAnZWagAA6BsP/09SD7N9+3wipn4MZvaE\n6C/x3J8M+TZnFLPp0HoR1C+PLZY9S6E25e8jvVBZm+qVQn0GlogvqBZTYy5t\nlagY5Q/MeeS6Hy342MzT/yazcjd3FD1aoyXKnOcP8Jv0pmuR1msfFRhKb83I\n+VbYwYlUDGCrT9X+eLoqaxzIKq8YadJMNm2du2BnAmMfSg+RETybn3tjCi4T\nP2BSS+7i6K8AtW05UVgn7ha07bKdtR2HJIJPeufIYYgGgYHmioxEW6HIV/uW\nuKqyj4knKtCp9cGnR0269NmxYlnnQAtAsxybUUfNMDE4Sle9T0pIYUeHWd6R\naMJLLDfqAadTerFtZ6TNq1nrbKur74MQVtmJweI9pzbryH9H5Xl3IG4D9v8l\n5ZvMPrjLjOfsBj9+mWUi4b1L7pxwAqbSumIxWVVFIRLMP5RHnq4ImtO+Y8Mj\nDQ7lPuiqmhMSTKkONlXlJc7CKvRnnw/RClQHc2s7JV9A1kAsrOQfmuw+4oVX\nHtd8/StS/OLkGwJiCVfM6w+DHQSronXYNyNCaumpSdpkhwHOfUqCQT/zYvy6\nMzFdzHJk+p6XGjQDUf0TjCUfhZP80Igck9qOnW9VA/apFktC+Ll1/kzNpX9i\nrDSf9WaBEfbQglKzokhgvyYqf1lPAm+Tq+Qq+55xOOPXyPbKxLcxdYe4u5cy\nZlb3\r\n=pbh9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHvNZmMSWRC4oGHTqpl8Z9e4Mr4BC9fsBcpfFPF87KYnAiANWaESf7PpsE3JVZdjdW9RkBWG3bRbfkj0WTxnXF4s5A=="}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.9.0_1599330434835_0.49587896899013995"},"_hasShrinkwrap":false},"0.9.1":{"name":"next-connect","version":"0.9.1","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"lint":"eslint lib -c .eslintrc --ext js","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^14.6.4","eslint":"^7.2.0","mocha":"^7.0.0","nyc":"^15.0.1","supertest":"^4.0.2"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.9.1","dist":{"shasum":"884faaf3df3af37838568009b84696c372e20272","integrity":"sha512-CPEdciM43y9oHKxE/KVtlB+vbWwTCYqPr8/EjzoMtSRIi0s7XhdSrY6VShlACnnsJzsAr/RZnL3/xFC/vjgZUQ==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.9.1.tgz","fileCount":8,"unpackedSize":16458,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkNPLCRA9TVsSAnZWagAAe5gQAJkoeA3F/bvNOqALTKyx\nVcwRaVcKPETsAX+MAE2qSujXV9JbeUADLur5BKkLMjxFOhb+5ttcFIwEYaVd\nAoP4j6QYdykDDypVCZgXvERHOZ8TBGNOkPCPNAzHukAnkyoqnspQryunNxBR\nHkcgKFcevLsN2wphvdkm7Qb+QhEAR206ol3VadrNCaIpjTvj2R1KccDtBEXK\nVG67LEmhz6Ki6GmxG1+ghNxm7gvh+qqBq2oSCRukym/+TRVh1qVyT4XweTUU\nqYDoBhzxYGe5bvCDGjTzavNhbuKyFf6CWfMseoUeIJ+FwWBHKqboaxNgHH/J\nPm4GG4vf1AD5Yi/lUUXI+nv/ppiAP00YSOa1dCY/K26GfjFClKA9oljTfjeR\nm11gnCcMaKiGSmtg2I4Otoi1trZtBHJmtySRcJ8WI2SGFGQI8Gtnvk4atl03\n3/SBktulg3fb59NViZMPwVKBuJO7EFNSyIO5pJuokIoYh7fHHnr7FbA37Yv6\n0BnVhL2/N6m5ILYU28Vjhy2dFWcBouzkwsyESSYj9N56YsfY39rkZ92+Xecz\nBq4vlgwTZt7rlU1nQuSK62CZ6+ILZKs24I9tCA6znrc8bJRKJx1Nw84F8I4h\nYZmk+xGSLO/WtwgZKcizUXaNHQWGRP/7+tquldJmnL5BcxD9xxzHDDbDFxAH\nQl7/\r\n=e4BT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJeuuYokd+KZkqm5jP1AZjcA57SeQ499tz8QpKxq66LAIhAPjz39N6GaW9jAPIXbNcVna4ZVP0BmFxfT7JyyJ9uqAx"}]},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.9.1_1603326923181_0.7838557516476996"},"_hasShrinkwrap":false},"0.10.0":{"name":"next-connect","version":"0.10.0","description":"The method routing and middleware layer for Next.js (and several others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js"}},"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","build":"bundt && cp src/index.d.ts dist","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^14.14.27","bundt":"^1.1.2","c8":"^7.5.0","eslint":"^7.20.0","mocha":"^8.3.0","supertest":"^6.1.3"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.10.0","dist":{"shasum":"61829818bea1989a003bf093f321c09b95c72cad","integrity":"sha512-W8oiw8ylXdMQJQG/FtBaSbXQkf9YgqEPh5sjfFOx6BlZVVLd8UP7Cp7qZe32lVAuQEGnU/JlmWkyzBOdt6xVrw==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.10.0.tgz","fileCount":9,"unpackedSize":21845,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgKXRkCRA9TVsSAnZWagAAIWAP/3dzXolZQ1hRE5UlntOo\nrimk8Q4JVjnHoqVGo+Jc+OWiO+ebkY27a47SWVXDXdnm1uwVTegoA7BSg0De\nckoCfn8KaQw43YYBflpRzrvrn0gcZO7ve2cMB8JUPZFknaW/pic1fgNkzSij\nRwp03HpNkb/IYsvId/aOncbuUlImAxwFLajlXhf/+2U1RZgW1foUqmqAPB9q\n41tULOAuGhCvWWoc16DaormFavrKWYmjuKGLgt9pxscG4jA6GPOANxDuMRaA\nIM9NhSUrTlCS58ZVZh2t+d9AAwQ9bTf0Rs9C9bW7+7yBd3VBEywIIlYorBon\nUMNZXhgritwrwIeZSG46clFV+UbP/EZ9ea2D2TUA3XHBqsYlT4M4asMvAPtX\nt6Dc3Chaz5uk7XfzmEziInatflN66sLSZA1dCruhQm9MKAtp9JGWqwjADMOy\ni6vhORuzgrmXDTTcQhVxnICaNVcGYvyTc83VQMK71TlJrD9JuRiqMJS8FRNJ\nwz/ON4C0X0Apgq98HducKJjGEw4yLBGaUO51Gqf3+ACnPDhzw7JYwb0lwjS7\ney7OAtH/ymHJoH0ZwGZrYpABffn2LoVSHHNgsnlFTnwTSvbjGxq2QeROmto1\nA9w+Id/YQ4lHHu/vJ3RtjdwJqM80nPqa0TyUAK0RrGG9CNO8vNYaqKojMmSO\n6lDP\r\n=zVQV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBiPoeeCHLpZ5SvBrDVqSgvimWU3dHHFL4Si/oeYnjtLAiBuOORd6QC3GeWUstj4z/SNeG0IYlAUDOi5SzwqMhHCuw=="}]},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.10.0_1613329507400_0.49761276215163"},"_hasShrinkwrap":false},"0.10.1":{"name":"next-connect","version":"0.10.1","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","build":"bundt && cp src/index.d.ts dist","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^14.14.27","bundt":"^1.1.2","c8":"^7.5.0","eslint":"^7.20.0","mocha":"^8.3.0","supertest":"^6.1.3"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.10.1","dist":{"shasum":"59628f98a184694a9415bef48076ed0fe10902ce","integrity":"sha512-gNpH53DtYfZhfOzmAVrE3jiEDj7kGtodeGcyUd2gvPsB+6/hQSmRVekCzNuF20+vpHnkpE8VUDQmzARzzqwpYA==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.10.1.tgz","fileCount":9,"unpackedSize":22777,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgUMyqCRA9TVsSAnZWagAAufUP/AzQ7JombSqAi3NnXo8M\n82EL8MO0Y95pGzUzcgxHx2KF3dQDxopYzyPtUaPF0V3AiicTM+xPzu4m4dhX\nT2PQFxklkzwsMAHIKm7+x7qu8k2lmlDymF2EhXMpXQ6BeEduMO50W+TKkrUS\nk1wN4RFjhMcPq4LS3Bnz1G5zrCfHM+PNWeF//xYbNZ1BLzFFGPpQ5JoVv/V+\nDll5dCZEz/GR6GO9pPpTmykKcJI/vqmd2rksCEMe8fQKKh8GFdaDd2rXX5mg\nSpK63ztzqxq09D4TL6uPrL4/LQHyW8DfQo/iZTo3duGRA2kOriCCjvajhbgI\nf/cYXDuup2vJud+bv8QP0dvGw/aswSMUTXqr7UgBPfLJvVZvw+Rv8R77gwDX\nvkbjb+C5J0K2mw1Bo+cKBdcYlPA9a9EchTTd1x5gUlOV43dVPGOoqu1041db\n4Rt/pYrwj5TryXr5Ps7m4+VdoTNYbCgKMLaN0YwUQrm7NkhZjATZEYs3Va8K\ng1xxxE+XVIeXxWsYVbW/PXMjxxhnKk7sQP1l3KsNBhKgm+fYuHBvsnNNWpsq\njpG1K5bLrhqJ9ewJTPkAGyaGKo4Kg3FBrDUMDVsXoDIqRZ7STJf3TuoODxcu\n5wxeWK1IkTlgn5N2R+zNzWPrm5UNM6H/sK/34W8CWaAdPK3LJ4iQj2e05CcW\nX5oM\r\n=MiGm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEbwVy6Fg3OzPHJJVXJ04hwkwvlTemUbxE6q6rEiqa6SAiEAoVMwUm6qajE5tlaV/LBX9goRxG/rGDEuflegpBLEApg="}]},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.10.1_1615908010397_0.6988461434416235"},"_hasShrinkwrap":false},"0.10.2":{"name":"next-connect","version":"0.10.2","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","build":"bundt && cp src/index.d.ts dist","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^14.14.27","bundt":"^1.1.2","c8":"^7.5.0","eslint":"^7.20.0","mocha":"^8.3.0","supertest":"^6.1.3"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.10.2","dist":{"shasum":"b361cffe1ce0aae46f7b3c91de2871d0ab40d0f6","integrity":"sha512-Tp9PA5YSg6aStF9TP+VmaQwvPH0tlO8VxzFP/oizD60aZwyqfK302J12V0VMlWnWJEQW5IPrblynI4bG193zwA==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.10.2.tgz","fileCount":9,"unpackedSize":24202,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhCrNxCRA9TVsSAnZWagAAJuAP+wZB4AE5d7K7DpMA/MR/\nx5aODZHk5rzIm1pinV4zp4oQsNc/tB4Qlp8ugGXULWbkRm2KWP1+Cv0hGE1z\nHh6HT35+lh5HKuc5+CFBpwv3mf/64gBu9twJrppXUh0WdJ0704jYBb/q92TM\nWOzpr0hd9Q+jV+pr8/LJvDuUaaq9DKHHqHUXjYvEZmPMH/GCFynjTmr2oWOe\n4PmhokSpza0p+285G57TnPvYDPkYmhCkGts2MmRMB8oX+VmxQWa9RXYXkQwn\nLOJ7I0yRCQhwE1jzft72dXmjhIKHuoPb1v1SneJpA3eypGusbCd7CU3YnCmd\nFRIXInwXw7ifiA+2xEQEI+YYZSLwU91gmk9Q5jATSGhkh3RvuPOJ4LalNSZ9\n8KO+25M6ERlhPm0AYVRlZjs3vucFJTRIWZ4T7t4BpwhFjwnAzVrZJqqxCYSw\nwo1nhrMY55dVkFQO1mJjzVr5cHjcDqxATinrSIY8Zw3v0RJAsBdYnN7CghcB\nWvYzYm2J5HEQzSgqKOaUX31qlXGY1r2/X18UGVnr+M+3Av5tOh7wbyFtWG5b\nkqSwfl4HJ46gZmil+RjJbUTiX4ws3Doe3nvGke5j5tFG5HxfA08YtrcOcrwD\neF4VNE7P6nzLd6AvOy2YiQRi18eOp7pYEaoPP54wFP0S6vIb4RdiEaqqajXQ\nIUpR\r\n=jqi2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDikMrrWPgMtWa0rhSO8cASVMfTLWvOv6YDlclLTbE4mgIhAJdqWjHGMsIqNAkh/p9CDbfK/yRmeU0mDTBZosrPv8IR"}]},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.10.2_1628091249442_0.662285829197593"},"_hasShrinkwrap":false},"0.11.0":{"name":"next-connect","version":"0.11.0","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","build":"bundt && cp src/index.d.ts dist","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^14.14.27","bundt":"^1.1.2","c8":"^7.5.0","eslint":"^7.20.0","mocha":"^8.3.0","supertest":"^6.1.3"},"dependencies":{"trouter":"^3.1.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 Hoang Vo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"next-connect@0.11.0","dist":{"shasum":"447c7b78937ff71f36c97d03f1623a6d0264ef49","integrity":"sha512-7VW5z9MWOpd8wnbST9dXgVd0c0V76LLLk5mBDYLSMtEC2dj3v3YF/Bl3t58cJrzm4SZ0e/s3yeD361F888u0yg==","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.11.0.tgz","fileCount":9,"unpackedSize":24905,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh20cMCRA9TVsSAnZWagAAQfYP/0oyUnYkA9qcorvZsOLh\nk+57QHhTsMxqrKptNWMsJ90d76sJIwXG/yp2fcfYZmowR7IIokb1HHhv0nQB\n+lCn4LVczxT6RYmBippSaup7mZ4b6i6HBoOTEeqbLgpYoB/4Y8xRPhMSJF3i\nRMVweZhivbEer1ZitKmSRBLTGr/2uE9sZhbM1OK5olm4DEH0QQqojnD1Eorr\nF6fOqlfqjwiMSKUDiF+v/OtZhUuYB5dLxt8zQ3v64SXjdLD542v19RX0s9sI\n8tN5AWqoju0319NKL7egbFmbRUdUYw9yjntHn0iT5gEkzxcRXuYaOm0OfZkK\nnhjtJepTog3zws0/8s3LYMnnzUul6W7HGPYhLyIDSTJcOytbb++xqLPR3JjT\nSZsStVmE9YARrcnmpGp8ta78A4ES3NwmE9wjWPWs1JRvMkF+r3/Otd0iMiAW\n6A8as0WJ04/kuA3DxKAqbEKmkMqEPgeH3zr/bSvyq4xgqz1NLP8m6OBDug8y\n7eXY/ctbNAagOfbeaLCKEIYVke0KlBoiM6TmE4/u/lTUnvPhL4ijM4Bx2d4L\n2EnrgssjenzH84LaoyW/EuEHkYgjOqxP5oKIyg4Ss6CmsaQiJr5N0zub80a/\n4C3Q+2/h/jl74/WquG4byaSUDKBjGHIMmGdtnHrA5qY8XH2uX5zsw9XPLssZ\nFmZa\r\n=qgBx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDioY1TxioRMPV6fyKym6LzqGjkGjTxUZMWNsTBLG+hDAiAAyqttWjvJ918IZdwRryu+6/xfYUM6qB6gN9jZPYewWQ=="}]},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.11.0_1634617719440_0.37784771927553096"},"_hasShrinkwrap":false},"0.11.1":{"name":"next-connect","version":"0.11.1","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","build":"bundt && cp src/index.d.ts dist","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^17.0.14","bundt":"^1.1.5","c8":"^7.11.0","eslint":"^8.8.0","mocha":"^9.2.0","supertest":"^6.2.2"},"dependencies":{"trouter":"^3.2.0"},"gitHead":"48a795f6971ec4ee2c5cdb326013c0b156d88c12","_id":"next-connect@0.11.1","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-qdFXRVN8TP4vBtqcifc2E/OsLamp5gtBqMl3gWSW9bCO2TBJovjvvQGZEv7eSGxHoqvGGn8rO/t4qTUKPUCPFw==","shasum":"3bdca8a7b91c366f7d15c8f03cb39933f65a87cc","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.11.1.tgz","fileCount":6,"unpackedSize":22970,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+7SJCRA9TVsSAnZWagAA0YsP/3CodyiDVwDSEwiPWSJw\naCafqpO7azWxYN2zKPixwD5M2D7+SN6sDZ0oyIRDwqMYgwUP4OkrEN5XJ6o7\nfxQmRKXFxpvoQU+4snvN4VXKCBF2piVRFZKOUy62HPCOJk8g4pHsGKzYGz54\n2Wn+h8yD5DrUDdN8SdVezwMEcuQQpHwEl9usoo9UrMcxPp1oj/YptmpK+UgJ\nAgqZPi5VCsB4AQPAeHzt+ldVLZ/TD7AGcsw5/owlGnvN7OmdeU0emyV57YlZ\n20gjIQLXLrD2szj7HyDT8VgueiwDgImMCNXoXx6+Y+vIUPruANaurEwD0q27\no2Zsvytr3y7zKCJk7+uMzREczIDnpr5diwjY0ScdWZc01AWJDJSXWK1ckRCF\nFTEk6gRDGEZHL+UQt+CtDlFOYMGjahXG1B80KFSFL+IL2opxgZJV9I3qZeYF\nUyN/LwcZzGdx5shzh5GyD468bm18wpbcvy43VygHw5PYaCgL8eNR+8783AH8\nzlzvL0UR8HWRd5S2sYVimFbssjDIT6RB3wmtRLsm/Uvwio9yNBha6IvyMk0l\nY8oeS4bjWVKmOriqynJOpyTKTlI0d0oDQndMgdWjLq7Hw+ct0wQJC8fHvwZQ\nC34JD+ERA9yrK6Gs8s+4OKKmynnyaLI7Qelp7whv1SMmTi6fWt1evlP+oLvp\nnMqv\r\n=AeKh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAUyTRbQgHBFzEhs5IgLzw4b4+UsOBTmxqbdJXXnoUWuAiAyWSzSPaKmlalZoxtZ4t/Di25ntL3zqNEtOgdE292Dfw=="}]},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.11.1_1643885705461_0.35937466046394917"},"_hasShrinkwrap":false},"0.12.0":{"name":"next-connect","version":"0.12.0","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","build":"bundt && cp src/index.d.ts dist","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^17.0.14","bundt":"^1.1.5","c8":"^7.11.0","eslint":"^8.8.0","mocha":"^9.2.0","supertest":"^6.2.2"},"dependencies":{"trouter":"^3.2.0"},"readme":"# next-connect\n\n[![npm](https://badgen.net/npm/v/next-connect)](https://www.npmjs.com/package/next-connect)\n[![CircleCI](https://circleci.com/gh/hoangvvo/next-connect.svg?style=svg)](https://circleci.com/gh/hoangvvo/next-connect)\n[![codecov](https://codecov.io/gh/hoangvvo/next-connect/branch/master/graph/badge.svg)](https://codecov.io/gh/hoangvvo/next-connect)\n[![minified size](https://badgen.net/bundlephobia/min/next-connect)](https://bundlephobia.com/result?p=next-connect)\n[![download/year](https://badgen.net/npm/dy/next-connect)](https://www.npmjs.com/package/next-connect)\n[![PRs Welcome](https://badgen.net/badge/PRs/welcome/ff5252)](CONTRIBUTING.md)\n\nThe smol method routing and middleware for [Next.js](https://nextjs.org/) (also works in [other frameworks](#using-in-other-frameworks)). Powered by [trouter](https://github.com/lukeed/trouter).\n\n## Features\n\n- Compatible with Express.js middleware and router => Drop-in replacement for Express.js.\n- Lightweight (~ 3KB) => Suitable for serverless environment.\n- 5x faster than Express.js with no overhead\n- Works with async handlers (with error catching)\n- TypeScript support\n\n## Installation\n\n```sh\nnpm install next-connect\n// or\nyarn add next-connect\n```\n\n## Usage\n\n`next-connect` is often used in [API Routes](https://nextjs.org/docs/api-routes/introduction):\n\n```javascript\n// pages/api/hello.js\nimport nc from \"next-connect\";\n\nconst handler = nc({\n  onError: (err, req, res, next) => {\n    console.error(err.stack);\n    res.status(500).end(\"Something broke!\");\n  },\n  onNoMatch: (req, res) => {\n    res.status(404).end(\"Page is not found\");\n  },\n})\n  .use(someMiddleware())\n  .get((req, res) => {\n    res.send(\"Hello world\");\n  })\n  .post((req, res) => {\n    res.json({ hello: \"world\" });\n  })\n  .put(async (req, res) => {\n    res.end(\"async/await is also supported!\");\n  })\n  .patch(async (req, res) => {\n    throw new Error(\"Throws me around! Error can be caught and handled.\");\n  });\n\nexport default handler;\n```\n\n**NOTE:** Make sure the response is sent or `handler()` will never resolve (unless `options.disableResponseWait` is `true`).\n\nFor quick migration from [Custom Express server](https://nextjs.org/docs/advanced-features/custom-server), simply replacing `express()` _and_ `express.Router()` with `nc()` and follow the [match multiple routes recipe](#catch-all).\n\nFor usage in pages with [`getServerSideProps`](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering), see [`.run`](#runreq-res).\n\nSee an example in [nextjs-mongodb-app](https://github.com/hoangvvo/nextjs-mongodb-app) (CRUD, Authentication with Passport, and more)\n\n### TypeScript\n\nBy default, the base interfaces of `req` and `res` are `IncomingMessage` and `ServerResponse`. When using in API Routes, you would set them to `NextApiRequest` and `NextApiResponse` by providing the generics to the factory function like so:\n\n```typescript\nimport { NextApiRequest, NextApiResponse } from \"next\";\nimport nc from \"next-connect\";\n\nconst handler = nc<NextApiRequest, NextApiResponse>();\n```\n\nIn each handler, you can also define custom properties to `req` and `res` (such as `req.user` or `res.cookie`) like so:\n\n```typescript\ninterface ExtendedRequest {\n  user: string;\n}\ninterface ExtendedResponse {\n  cookie(name: string, value: string): void;\n}\n\nhandler.post<ExtendedRequest, ExtendedResponse>((req, res) => {\n  req.user = \"Anakin\";\n  res.cookie(\"sid\", \"8108\");\n});\n```\n\n## API\n\nThe API is similar to [Express.js](https://github.com/expressjs/express) with several differences:\n\n- It does not include any [helper methods](http://expressjs.com/en/4x/api.html#res.append) or template engine (you can incorporate them using middleware).\n- It does not support error-handling middleware pattern. Use `options.onError` instead.\n\nIt is more like good ol' [connect](https://www.npmjs.com/package/connect) (hence the name) with method routing.\n\n### handler = nc(options?)\n\nInitialize an instance of `next-connect`.\n\n#### options.onError\n\n**Important:** It is strongly recommended to set this option, since the default does not report the error to the terminal.\n\nAccepts a function as a catch-all error handler; executed whenever a middleware throws an error.\nBy default, it responds with status code `500` and an error message if any.\n\n```javascript\nfunction onError(err, req, res, next) {\n  logger.log(err);\n  // OR: console.error(err);\n\n  res.status(500).end(err.toString());\n  // OR: you may want to continue\n  next();\n}\n\nconst handler = nc({ onError });\n\nhandler\n  .use((req, res, next) => {\n    throw new Error(\"oh no!\");\n    // or use next\n    next(Error(\"oh no\"));\n  })\n  .use((req, res) => {\n    // this will run if next() is called in onError\n    res.end(\"error no more\");\n  });\n```\n\n**Note:** This option is ignored if `handler` is used as a sub app or when `handler.run()` is used.\n\n#### options.onNoMatch\n\nAccepts a function of `(req, res)` as a handler when no route is matched.\nBy default, it responds with `404` status and `not found` body.\n\n```javascript\nfunction onNoMatch(req, res) {\n  res.status(404).end(\"page is not found... or is it\");\n}\n\nconst handler = nc({ onNoMatch });\n```\n\n**Note:** This option is ignored if `handler` is used as a sub app or when `handler.run()` is used.\n\n#### options.attachParams\n\nPassing `true` will attach `params` object to `req`. By default, it does not set to `req.params`.\n\n```javascript\nconst handler = nc({ attachParams: true });\n\nhandler.get(\"/users/:userId/posts/:postId\", (req, res) => {\n  // Visiting '/users/12/posts/23' will render '{\"userId\":\"12\",\"postId\":\"23\"}'\n  res.send(req.params);\n});\n```\n\n### options.disableResponseWait\n\nPassing `true` will disable waiting for the response to end (that is, after `res.end()` is called) before resolving the `handler(req, res)` promise.\n\n```js\nawait handler(req, res);\n// will not reach here unless res.end() has been called or options.disableResponseWait is true.\n```\n\n**Note:** This option is ignored if `handler` is used as a sub app or when `handler.run()` is used.\n\n### handler.use(base, ...fn)\n\n`base` (optional) - match all route to the right of `base` or match all if omitted. (Note: If used in Next.js, this is often omitted)\n\n`fn`(s) can either be:\n\n- functions of `(req, res[, next])`\n- **or** an instance of `next-connect`, where it will act as a sub application. `onError` and `onNoMatch` of that subapp are disregarded.\n\n```javascript\n// Mount a middleware function\nhandler.use((req, res, next) => {\n  req.hello = \"world\";\n  next(); // call to proceed to next in chain\n});\n\n// Or include a base\nhandler.use(\"/foo\", fn); // Only run in /foo/**\n\n// Mount an instance of next-connect\nconst common = nc().use(midd1).use(\"/\", midd2); // good for common middlewares\nconst auth = nc().use(\"/dashboard\", checkAuth);\nconst subapp = nc().get(getHandle).post(\"/baz\", postHandle).put(\"/\", putHandle);\nhandler\n  // `midd1` and `midd2` runs everywhere\n  .use(common)\n  // `checkAuth` only runs on /dashboard/*\n  .use(auth)\n  // `getHandle` runs on /foo/*\n  // `postHandle` runs on /foo/baz\n  // `putHandle` runs on /foo\n  .use(\"/foo\", subapp);\n\n// You can use a library too.\nhandler.use(passport.initialize());\n```\n\n### handler.METHOD(pattern, ...fns)\n\n`METHOD` is a HTTP method (`GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `TRACE`) in lowercase.\n\n`pattern` (optional) - match all route based on [supported](https://github.com/lukeed/trouter#pattern) pattern or match all if omitted.\n\n`fn`(s) are functions of `(req, res[, next])`. This is ideal to be used in API Routes.\n\n```javascript\nhandler.get(\"/api/user\", (req, res, next) => {\n  res.json(req.user);\n});\nhandler.post(\"/api/users\", (req, res, next) => {\n  res.end(\"User created\");\n});\nhandler.put(\"/api/user/:id\", (req, res, next) => {\n  // https://nextjs.org/docs/routing/dynamic-routes\n  res.end(`User ${req.query.id} updated`);\n});\nhandler.get((req, res, next) => {\n  res.end(\"This matches whatever route\");\n});\n```\n\nHowever, since Next.js already handles routing (including dynamic routes), we often omit `pattern` in `.METHOD`.\n\n**Note:** You should understand Next.js [file-system based routing](https://nextjs.org/docs/routing/introduction). For example, having a `handler.put(\"/api/foo\", handler)` inside `page/api/index.js` _does not_ serve that handler at `/api/foo`.\n\n### handler.all(pattern, ...fns)\n\nSame as [.METHOD](#methodpattern-fns) but accepts _any_ methods.\n\n### handler.run(req, res)\n\nRuns `req` and `res` the middleware and returns a **promise**. It will **not** render `404` on not found or `onError` on error.\n\n**Note:** You _MUST_ call `next()` in the final handler for the promise to resolve.\n\nThis can be useful in [`getServerSideProps`](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering).\n\n```javascript\n// page/index.js\nexport async function getServerSideProps({ req, res }) {\n  const handler = nc()\n    .use(passport.initialize())\n    .post(async (req, res, next) => {\n      await logPostRequest(req);\n      next(); // <- make sure next() is called\n    });\n  try {\n    await handler.run(req, res);\n  } catch (e) {\n    // handle the error\n  }\n  // do something with the upgraded req and res\n  return {\n    props: { user: req.user },\n  };\n}\n```\n\n## Common errors\n\n1. **DO NOT** reuse the same instance of `nc` like the below pattern:\n\n```js\n// middleware/common\nexport default nc().use(a).use(b);\n\n// api/foo\nimport Handler from \"middleware/common\";\nexport default Handler.get(x);\n\n// api/bar\nimport Handler from \"middleware/common\";\nexport default Handler.get(y);\n```\n\nThis is because in each API Route, the same NextConnect instance is mutated, leading to undefined behaviors.\nIf you want to achieve the something like that, try rewriting the base instance as a factory function to avoid reusing the same instance:\n\n```js\n// middleware/common\nexport default function base() {\n  return nc().use(a).use(b);\n}\n\n// api/foo\nimport base from \"middleware/common\";\nexport default base().get(x);\n\n// api/bar\nimport base from \"middleware/common\";\nexport default base().get(y);\n```\n\n2. **DO NOT** use response function like `res.(s)end` or `res.redirect` inside `getServerSideProps`.\n\n```js\n// page/index.js\nconst handler = nc()\n  .use((req, res) => {\n    // BAD: res.redirect is not a function (not defined in `getServerSideProps`\n    res.redirect(\"foo\");\n  })\n  .use((req, res) => {\n    // BAD: `getServerSideProps` gives undefined behavior if we try to send response\n    res.end(\"bar\");\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  await handler.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n3. **DO NOT** use `handler(req, res)` directly in `getServerSideProps`.\n\n```js\n// page/index.js\nconst handler = nc().use(foo).use(bar);\n\nexport async function getServerSideProps({ req, res }) {\n  await handler(req, res); // BAD: You must you handler.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n## Recipes\n\n### Next.js\n\n<details id=\"catch-all\">\n<summary>Match multiple routes</summary>\n\nIf you created the file `/api/<specific route>.js` folder, the handler will only run on that specific route.\n\nIf you need to create all handlers for all routes in one file (similar to `Express.js`). You can use [Optional catch all API routes](https://nextjs.org/docs/api-routes/dynamic-api-routes#optional-catch-all-api-routes).\n\n```js\n// pages/api/[[...slug]].js\nimport nc from \"next-connect\";\n\nconst handler = nc({ attachParams: true })\n  .use(\"/api/hello\", someMiddleware())\n  .get(\"/api/user/:userId\", (req, res) => {\n    res.send(`Hello ${req.params.userId}`);\n  });\n\nexport default handler;\n```\n\nWhile this allows quick migration from Express.js, consider seperating routes into different files (`/api/user/[userId].js`, `/api/hello.js`) in the future.\n\n</details>\n\n### Using in other frameworks\n\n`next-connect` supports any frameworks and runtimes that support `(req, res) => void` handler.\n\n<details>\n<summary><a href=\"https://github.com/zeit/micro\">Micro</a></summary>\n\n```javascript\nconst { send } = require(\"micro\");\nconst nc = require(\"next-connect\");\n\nmodule.exports = nc()\n  .use(middleware)\n  .get((req, res) => {\n    res.end(\"Hello World!\");\n  })\n  .post((req, res) => {\n    send(res, 200, { hello: \"world\" });\n  });\n```\n\n</details>\n\n<details>\n<summary><a href=\"https://vercel.com/docs/serverless-functions/introduction\">Vercel</a></summary>\n\n```javascript\nconst nc = require(\"next-connect\");\n\nmodule.exports = nc()\n  .use(middleware)\n  .get((req, res) => {\n    res.send(\"Hello World!\");\n  })\n  .post((req, res) => {\n    res.json({ hello: \"world\" });\n  });\n```\n\n</details>\n\n<details>\n<summary>Node.js <a href=\"https://nodejs.org/api/http.html\">HTTP</a> / <a href=\"https://nodejs.org/api/http2.html\">HTTP2</a> Server</summary>\n\n```javascript\nconst http = require(\"http\");\n// const http2 = require('http2');\nconst nc = require(\"next-connect\");\n\nconst handler = nc()\n  .use(middleware)\n  .get((req, res) => {\n    res.end(\"Hello world\");\n  })\n  .post((req, res) => {\n    res.setHeader(\"content-type\", \"application/json\");\n    res.end(JSON.stringify({ hello: \"world\" }));\n  });\n\nhttp.createServer(handler).listen(PORT);\n// http2.createServer(handler).listen(PORT);\n```\n\n</details>\n\n## Contributing\n\nPlease see my [contributing.md](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"a827f76d3608c84732d82825531988510e973b3c","_id":"next-connect@0.12.0","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-FTRRlTNjNsFcXiVUBj9v009s4wrqsm6DAaX11Y+CyG5Nogmi4OUF+2UmAm1N849AvrP7ddxGWKCNIWDkx9nvNg==","shasum":"323a72b3b25d8de56aba5ba4c365904815afdc3d","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.12.0.tgz","fileCount":6,"unpackedSize":24801,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/kZQCRA9TVsSAnZWagAAPPEP+wSU1VjVzuquUcqoT7aZ\n/sbVwxQqDgNAEbkA2LgRym4GnAwB/wcWCVtasG9+/+4AvzM9QGnbrs8fBw20\nXAe/7lapPjUFixNNX0YoYt1RNyZKb9rJN2FAwWbgGLv2YzfjIF+00SalndzI\nOpZ3XbG33cytQemWRap+rwzg+PFZxYcv9j0cw/utIh7xZZqR3KBmtPKlbOgd\nGsMSoqisqjubWzr/Ktt6/MdWReLTvBTySlLLBvHukrG77mP++jceRbAMYZ0i\nqRTHxe2nVWPthU70EzvwDLAqQ2J75FZKDwzWuDE87B6xGdoaMdsSUtlX1u2E\n9UyXq1VdPCW+Df9nZMVSi9ANjxXf7CUlLa7UaAxQeGELB0HfP2EreRa3GsWH\nt8o6qmihnUgU3WHuZoAyCLH+5YBcLHY6Xasdrbfr1pmWjn6G7Uu+xk53ntuj\nGc8sFqMe1Hjyfv36CxvSNxUL3YPGYkRwP3H8igwl9V0xiO976tG1PPWLyJUV\nBXhuBx/1ZLbH9cpNcW1aqaU1J5VQ7V6nOyUMjQh5JhjHueQ6sTlZVKK3r8vS\nkCku5jJwfaWgD0zbfU29azUQmswfWCuAkv17+640zpZ0bIJ8AtZD2SSkqN5A\nHtCJN1b3JspsFmMc2bxJrTpK+8sm4FA6T1ac9U2yuZk1bghl+14ltj1s3+J5\nBRq4\r\n=Q2PR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD77qWtfJGB8Xrp+HaVivJRpK0D0KmkTGa1GxjgIc+KgwIgFMl0Enw+KqgAk39o5lud49VfJqE2jRSM68IjaAPzPg4="}]},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.12.0_1644054096759_0.3827162675795286"},"_hasShrinkwrap":false},"0.12.1":{"name":"next-connect","version":"0.12.1","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","build":"bundt && cp src/index.d.ts dist","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^17.0.14","bundt":"^1.1.5","c8":"^7.11.0","eslint":"^8.8.0","mocha":"^9.2.0","supertest":"^6.2.2"},"dependencies":{"trouter":"^3.2.0"},"gitHead":"d9de767b66b91badc56e02dd16de895c322a626f","_id":"next-connect@0.12.1","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-pzW3oKCYAaNOxQncIIv53cHrRaZSeQ2KZ9chjYx/OHgASV8qDNlVvD3Mz9RTrO9TuJs3kjt0VeTBGJmoE/yl2g==","shasum":"9e1c2b107544c27a26f00d11eb1d5e432b9853b4","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.12.1.tgz","fileCount":6,"unpackedSize":24809,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiAWtfCRA9TVsSAnZWagAAyOwP/RhMD7bQQxl+cgk48lb5\nKpPArl+KWprPSdGrOhMIVfMpXlospDkORCoPaDzJG4HSe7zoqHDwFSMTuvrB\n5YojGOpnpx+XtU5wSJn/ogtDnPrt+BusH/cZpfbSfRt+dg6FXpMhUFR7cL3w\nUOIQKCdWX3ypMpOO/XUbZrSk/pADxkm1vWRF0xVEKiXhbGAjCVA/d5Wfujpp\nxu2SYKU8ijH1BdYRILp5N0oYX9Me9rp73vMxyfPTtmDcthqm0tJUPjJhXkmM\ngpWiRpnK53nQMhvEyVhTLN1I+MpkwK6Vnu8B1lqxARZlskXuEEUbymKkV1kC\nAH0xuz9tHKnA2oDAWtXmMwU+NjEZ2qd7baoQOUmNOk9U8l2fxFV5WCs1L+mb\nGKdENY31gLtUw+eYifps+jPNJddz/ACCJgkIAFrYzpx0qH71PNAhOgTVW1oY\numX26sZKYwJPUvQrViFAaDyj/MTdKsYoLAWon8Iwn5vC1aOKil2FzMyxd3X/\nxiS3FQgn71Ue5yw6TZwqN0wDHh1DveU6E30+VvNjKcDlHwKDBj9HOqgZKLUr\nKpT0wvErXCKBvwqYMajrFwkRtO8djV5uOBg76TmP980tk7G1SqfQ7mo61pp4\nsxuW7fTu7hWx/6IZ3Uz4fnKEjyNPLIsXbMl/1s8clIyrtcIQEDu6/cn5BFfS\n30i/\r\n=97M0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCBJIJwX0vGus5xqwQQ48ZgJOtn7jkE51/0HOggpFvrFQIgB7sukMicMmLzXQDbQRyUAPVun0VzkHQPRdpnmQ5XT0A="}]},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.12.1_1644260190881_0.14456659394624571"},"_hasShrinkwrap":false},"0.12.2":{"name":"next-connect","version":"0.12.2","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","build":"bundt && cp src/index.d.ts dist","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^17.0.14","bundt":"^1.1.5","c8":"^7.11.0","eslint":"^8.8.0","mocha":"^9.2.0","supertest":"^6.2.2"},"dependencies":{"trouter":"^3.2.0"},"gitHead":"89196b1938a62ad03f7fb1993623ad0002754e70","_id":"next-connect@0.12.2","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-B/zKHPs5S7XWvAVsZVLvOeY2eL2U3g0W/BgCDetEJRcNDzxX2vi8rzqBuEoLLPlI8LvtHwujDVUFFjSgOEZTbA==","shasum":"8191db0f03c80f8f4dbbe80e643a48cb3c9a20b9","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.12.2.tgz","fileCount":6,"unpackedSize":24832,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiEdheACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr4Zg/9HmExH5XBW4J0+l8QBvd5Tx7WJXSrmrYC8sc1c3gAJA9tffd0\r\ndQW4kYA//a8iWcj7/EtxrDoaFoRgAviCXDHgyDbH06jMqbPhnR1CJ2OAiknt\r\nm21V1MOhD4C+l0hLJgY39Ud3XZeZATKlvWz1G53zzDKjXnOYd/NbWH22csDl\r\noLzyvgKoiZxzcXFiyboPrT+mukeMdBhehVrcFEF3MkVDbQxKye+eVCc/sGAw\r\noq8h3/aviBQVuFhDxjTPJxi7quh+SB2EVbo/KhQjqdPNaMsOJmutdj6Cxmpa\r\nHX4r0ga+an3TdUOHMXkEspIFKBw10ugMNnjgxEvGePGj7ZiGGATdYfmZfUXy\r\njtR/GOnef0dxKMhoBdUUY+y2NzLSERU+pNp+HVbGkr9CIDyn8n0ly0OvWrai\r\nOwr7KVNDbzk1lammkK/cNynyo+0BSzJMVvG02Z0908aYs+Z29DD0cxMeapE3\r\n+JBgJYM4++NjpJQGjjoGYb2bBvzFoIr6DNzDkflCRx7pO4I35bJIE7Sh76IL\r\nZMmru3y9Ro4To5yvKitQPSUSvodJkCn8ehvnCr+5rZI45P7wY1fK8vS7ZKg9\r\nMpR5flL5Mr8yp3yQnlFFsXdYzGXfzRgucyTI1AnhsKF/qq9SfOxnSjFxiL0Y\r\nS+oIx9xYehjTfv18C2G9AmYeBhP0u80IZ3I=\r\n=r9PN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEImB2jwGcOW37UEUFcE1zbR3rWTzMKyMz1o0JjF3SAXAiEAsy0aJP34L8TA17fqm5j3wBhP0WEAMiRRWfqu8IdTYvQ="}]},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.12.2_1645336670232_0.9749444276860368"},"_hasShrinkwrap":false},"1.0.0-next.0":{"name":"next-connect","version":"1.0.0-next.0","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","exports":{"import":{"types":"./dist/types/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/types/index.d.ts","default":"./dist/commonjs/index.cjs"}},"main":"./dist/commonjs/index.cjs","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","sideEffects":false,"scripts":{"build:esm":"tsc --outDir ./dist/esm","build:commonjs":"tsc --outDir ./dist/commonjs --module commonjs && node ./scripts/rename-cjs-extenstion.js ./dist/commonjs","build:types":"tsc --outDir ./dist/types --declaration --emitDeclarationOnly","build":"npm run build:esm && npm run build:commonjs && npm run build:types","test":"c8 tap","prepublishOnly":"npm run clean && npm run test && npm run build","coverage":"c8 report --reporter=lcov","lint":"eslint ./src --ext json,ts --ignore-path .gitignore","format":"prettier . -w --ignore-path ./.gitignore","clean":"rm -rf ./dist"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@tsconfig/node14":"^1.0.3","@types/node":"^18.0.0","@types/tap":"^15.0.7","@typescript-eslint/eslint-plugin":"^5.30.3","@typescript-eslint/parser":"^5.30.3","c8":"^7.11.3","eslint":"^8.19.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.7.1","tap":"^16.3.0","ts-node":"^10.8.1","typescript":"^4.7.4"},"tap":{"node-arg":["--loader","ts-node/esm"],"coverage":false},"dependencies":{"regexparam":"^2.0.1"},"engines":{"node":">=12.22.0"},"readme":"# next-connect\n\n[![npm](https://badgen.net/npm/v/next-connect)](https://www.npmjs.com/package/next-connect)\n[![CircleCI](https://circleci.com/gh/hoangvvo/next-connect.svg?style=svg)](https://circleci.com/gh/hoangvvo/next-connect)\n[![codecov](https://codecov.io/gh/hoangvvo/next-connect/branch/main/graph/badge.svg?token=LGIyl3Ti4H)](https://codecov.io/gh/hoangvvo/next-connect)\n[![minified size](https://badgen.net/bundlephobia/min/next-connect)](https://bundlephobia.com/result?p=next-connect)\n[![download/year](https://badgen.net/npm/dy/next-connect)](https://www.npmjs.com/package/next-connect)\n\nThe promise-based method routing and middleware layer for [Next.js](https://nextjs.org/) and many other frameworks.\n\n> **Warning**\n> v1 is a complete rewrite of v0 and is not backward-compatible. See [Releases](https://github.com/hoangvvo/next-connect/releases) to learn about the changes.\n\n## Features\n\n- [Koa](https://koajs.com/)-like Async middleware\n- Lightweight => Suitable for serverless environment\n- 5x faster than Express.js with no overhead. Compatible with Express.js via [a wrapper](#expressjs-compatibility).\n- Works with async handlers (with error catching)\n- TypeScript support\n\n## Installation\n\n```sh\nnpm install next-connect@next\n```\n\n## Usage\n\n> **Note**\n>\n> Although `next-connect` is initially written for Next.js, it can be used in [http server](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener), [Vercel](https://vercel.com/docs/concepts/functions/serverless-functions). See [Examples](./examples/) for more integrations.\n\nBelow are some use cases.\n\n### Next.js API Routes\n\n```typescript\n// pages/api/hello.js\nimport type { NextApiRequest, NextApiResponse } from \"next\";\nimport { createRouter } from \"next-connect\";\n\n// Default Req and Res are IncomingMessage and ServerResponse\n// You may want to pass in NextApiRequest and NextApiResponse\nconst router = createRouter<NextApiRequest, NextApiResponse>();\n\nrouter\n  .use(async (req, res, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .use(authMiddleware)\n  .get((req, res) => {\n    res.send(\"Hello world\");\n  })\n  .post(async (req, res) => {\n    // use async/await\n    const user = await insertUser(req.body.user);\n    res.json({ user });\n  })\n  .put(\n    async (req, res, next) => {\n      // You may want to pass in NextApiRequest & { isLoggedIn: true }\n      // in createRouter generics to define this extra property\n      if (!req.isLoggedIn) throw new Error(\"thrown stuff will be caught\");\n      // go to the next in chain\n      return next();\n    },\n    async (req, res) => {\n      const user = await updateUser(req.body.user);\n      res.json({ user });\n    }\n  );\n\n// create a handler from router with custom\n// onError and onNoMatch\nexport default router.handler({\n  onError: (err, req, res, next) => {\n    console.error(err.stack);\n    res.status(500).end(\"Something broke!\");\n  },\n  onNoMatch: (req, res) => {\n    res.status(404).end(\"Page is not found\");\n  },\n});\n```\n\n### Next.js getServerSideProps\n\n```jsx\n// page/users/[id].js\nimport { createRouter } from \"next-connect\";\n\nexport default function Page({ user, updated }) {\n  return (\n    <div>\n      {updated && <p>User has been updated</p>}\n      <div>{JSON.stringify(user)}</div>\n      <form method=\"POST\">{/* User update form */}</form>\n    </div>\n  );\n}\n\nconst router = createRouter()\n  .use(async (req, res, next) => {\n    logRequest(req);\n    return next();\n  })\n  .get(async (req, res) => {\n    const user = await getUser(req.params.id);\n    if (!user) {\n      // https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#notfound\n      return { props: { notFound: true } };\n    }\n    return {\n      props: { user, updated: true },\n    };\n  })\n  .post(async (req, res) => {\n    const user = await updateUser(req);\n    return {\n      props: { user, updated: true },\n    };\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  try {\n    // we await here so that the error can be caught below\n    // rather than propagate to the outer layer\n    return await router.run(req, res);\n  } catch (e) {\n    // handle the error\n    return {\n      props: { error: e.message },\n    };\n  }\n}\n```\n\n## API\n\n### router = createRouter(options)\n\nCreate an instance Node.js router.\n\n**options.attachParams**\n\nPassing `true` will attach params object to req. By default, `next-connect` does not set to req.params. If `req.params` already exists, it [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) into `req.params`.\n\n```js\nconst router = createRouter({ attachParams: true });\n\nrouter.get(\"/users/:userId/posts/:postId\", (req, res) => {\n  // Visiting '/users/12/posts/23' will render '{\"userId\":\"12\",\"postId\":\"23\"}'\n  res.send(req.params);\n});\n```\n\n### router.use(base, ...fn)\n\n`base` (optional) - match all routes to the right of `base` or match all if omitted. (Note: If used in Next.js, this is often omitted)\n\n`fn`(s) can either be:\n\n- functions of `(req, res[, next])`\n- **or** a router instance\n\n```javascript\n// Mount a middleware function\nrouter1.use(async (req, res, next) => {\n  req.hello = \"world\";\n  await next(); // call to proceed to the next in chain\n  console.log(\"request is done\"); // call after all downstream handler has run\n});\n\n// Or include a base\nrouter2.use(\"/foo\", fn); // Only run in /foo/**\n\n// mount an instance of router\nconst sub1 = createRouter().use(fn1, fn2);\nconst sub2 = createRouter().use(\"/dashboard\", auth);\nconst sub3 = createRouter()\n  .use(\"/waldo\", subby)\n  .get(getty)\n  .post(\"/baz\", posty)\n  .put(\"/\", putty);\nrouter3\n  // - fn1 and fn2 always run\n  // - auth runs only on /dashboard\n  .use(sub1, sub2)\n  // `subby` runs on ANY /foo/waldo?/*\n  // `getty` runs on GET /foo/*\n  // `posty` runs on POST /foo/baz\n  // `putty` runs on PUT /foo\n  .use(\"/foo\", sub3);\n```\n\n### router.METHOD(pattern, ...fns)\n\n`METHOD` is an HTTP method (`GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `TRACE`) in lowercase.\n\n`pattern` (optional) - match routes based on [supported pattern](https://github.com/lukeed/regexparam#regexparam-) or match any if omitted.\n\n`fn`(s) are functions of `(req, res[, next])`.\n\n```javascript\nrouter.get(\"/api/user\", (req, res, next) => {\n  res.json(req.user);\n});\nrouter.post(\"/api/users\", (req, res, next) => {\n  res.end(\"User created\");\n});\nrouter.put(\"/api/user/:id\", (req, res, next) => {\n  // https://nextjs.org/docs/routing/dynamic-routes\n  res.end(`User ${req.query.id} updated`);\n});\n\n// Next.js already handles routing (including dynamic routes), we often\n// omit `pattern` in `.METHOD`\nrouter.get((req, res, next) => {\n  res.end(\"This matches whatever route\");\n});\n```\n\n> **Note**\n> You should understand Next.js [file-system based routing](https://nextjs.org/docs/routing/introduction). For example, having a `router.put(\"/api/foo\", handler)` inside `page/api/index.js` _does not_ serve that handler at `/api/foo`.\n\n### router.all(pattern, ...fns)\n\nSame as [.METHOD](#methodpattern-fns) but accepts _any_ methods.\n\n### router.handler(options)\n\nCreate a handler to handle incoming requests.\n\n**options.onError**\n\nAccepts a function as a catch-all error handler; executed whenever a handler throws an error.\nBy default, it responds with status code `500` and an error stack if any.\n\n```javascript\nfunction onError(err, req, res) {\n  logger.log(err);\n  // OR: console.error(err);\n\n  res.status(500).end(\"Internal server error\");\n}\n\nexport default router.handler({ onError });\n```\n\n> **Warning**\n> The default option prints the error stack, which might be a security risk. Consider defining a custom one like the above to mitigate the risk.\n\n**options.onNoMatch**\n\nAccepts a function of `(req, res)` as a handler when no route is matched.\nBy default, it responds with a `404` status and a `Route [Method] [Url] not found` body.\n\n```javascript\nfunction onNoMatch(req, res) {\n  res.status(404).end(\"page is not found... or is it!?\");\n}\n\nexport default router.handler({ onNoMatch });\n```\n\n### router.run(req, res)\n\nRuns `req` and `res` through the middleware chain and returns a **promise**. It resolves with the value returned from handlers.\n\n```js\nrouter\n  .use(async (req, res, next) => {\n    return (await next()) + 1;\n  })\n  .use(async () => {\n    return (await next()) + 2;\n  })\n  .use(async () => {\n    return 3;\n  });\n\nconsole.log(await router.run(req, res));\n// The above will print \"6\"\n```\n\nThis can be useful in [`getServerSideProps`](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering).\n\n## Common errors\n\nThere are some pitfalls in using `next-connect`. Below are things to keep in mind to use it correctly.\n\n1. **Always** `await next()`\n\nIf `next()` is not awaited, errors will not be caught if they are thrown in async handlers, leading to `UnhandledPromiseRejection`.\n\n```javascript\n// OK: we don't use async so no need to await\nrouter\n  .use((req, res, next) => {\n    next();\n  })\n  .use((req, res, next) => {\n    next();\n  })\n  .use(() => {\n    throw new Error(\"💥\");\n  });\n\n// BAD: This will lead to UnhandledPromiseRejection\nrouter\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n  });\n\n// GOOD\nrouter\n  .use(async (req, res, next) => {\n    await next(); // next() is awaited, so errors are caught properly\n  })\n  .use((req, res, next) => {\n    return next(); // this works as well since we forward the rejected promise\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n    // return new Promise.reject(\"💥\");\n  });\n```\n\nAnother issue is that the handler would resolve before all the code in each layer runs.\n\n```javascript\nconst handler = router\n  .use(async (req, res, next) => {\n    next(); // this is not returned or await\n  })\n  .get(async () => {\n    // simulate a long task\n    await new Promise((resolve) => setTimeout(resolve, 1000));\n    res.send(\"ok\");\n    console.log(\"request is completed\");\n  })\n  .handler();\n\nawait handler(req, res);\nconsole.log(\"finally\"); // this will run before the get layer gets to finish\n\n// This will result in:\n// 1) \"finally\"\n// 2) \"request is completed\"\n```\n\n2. **DO NOT** reuse the same instance of `router` like the below pattern:\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.get(x);\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.get(y);\n```\n\nThis is because, in each API Route, the same router instance is mutated, leading to undefined behaviors.\nIf you want to achieve something like that, you can use `router.clone` to return different instances with the same routes populated.\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(x);\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(y);\n```\n\n3. **DO NOT** use response function like `res.(s)end` or `res.redirect` inside `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst handler = createRouter()\n  .use((req, res) => {\n    // BAD: res.redirect is not a function (not defined in `getServerSideProps`)\n    // See https://github.com/hoangvvo/next-connect/issues/194#issuecomment-1172961741 for a solution\n    res.redirect(\"foo\");\n  })\n  .use((req, res) => {\n    // BAD: `getServerSideProps` gives undefined behavior if we try to send a response\n    res.end(\"bar\");\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  await router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n3. **DO NOT** use `handler()` directly in `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst router = createRouter().use(foo).use(bar);\nconst handler = router.handler();\n\nexport async function getServerSideProps({ req, res }) {\n  await handler(req, res); // BAD: You should call router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n## Recipes\n\n### Next.js\n\n<details>\n<summary>Match multiple routes</summary>\n\nIf you created the file `/api/<specific route>.js` folder, the handler will only run on that specific route.\n\nIf you need to create all handlers for all routes in one file (similar to `Express.js`). You can use [Optional catch-all API routes](https://nextjs.org/docs/api-routes/dynamic-api-routes#optional-catch-all-api-routes).\n\n```javascript\n// pages/api/[[...slug]].js\nimport { createRouter } from \"next-connect\";\n\nconst router = createRouter()\n  .use(\"/api/hello\", someMiddleware())\n  .get(\"/api/user/:userId\", (req, res) => {\n    res.send(`Hello ${req.params.userId}`);\n  });\n\nexport default router.handler();\n```\n\nWhile this allows quick migration from Express.js, consider seperating routes into different files (`/api/user/[userId].js`, `/api/hello.js`) in the future.\n\n</details>\n\n### Express.js Compatibility\n\n<details>\n<summary>Middleware wrapper</summary>\n\nExpress middleware is not built around promises but callbacks. This prevents it from playing well in the `next-connect` model. Understanding the way express middleware works, we can build a wrapper like the below:\n\n```js\nimport someExpressMiddleware from \"some-express-middleware\";\n\nconst withExpressMiddleware = (middleware) => {\n  return async (req, res, next) => {\n    await new Promise((resolve, reject) => {\n      middleware(req, res, (err) => (err ? reject(err) : resolve()));\n    });\n    return next();\n  };\n};\n\nrouter.use(withExpressMiddleware(someExpressMiddleware));\n```\n\n</details>\n\n## Contributing\n\nPlease see my [contributing.md](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"d1ecbc875ac9fc6cccb7b28f29caa7893d6afb91","_id":"next-connect@1.0.0-next.0","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-z5LRlYVpIHW0kkn4BJt7Sa4Z7Rti7B+HGBlvZP/HTOS0LueJOXIjEY5YXL3qLc5yvn63AwdT76l5TO/qPQFdsw==","shasum":"2f239dab0aa797e775b3c83c1f972a86d85cc976","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-1.0.0-next.0.tgz","fileCount":15,"unpackedSize":34280,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLCvw4TRLrhHh2a3MswR9i9Do0gAKmu2ZxwQVfsD6eggIhAPV0XP0XqoYogAg+G/EJW90r5P/9Wk8LsRmYQKb5mSKc"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiwfRpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpGXRAApCRnnj6eLN75MgOFD5+MTP0cek4cSruxRAmLd14aCfbqEheZ\r\nRx+hMkpwPNHP/wPGjS+ddUWtOkRW28PhjF1eB1QK4PdhOHhTyJNaftRxXDF3\r\nGGsrXUo4VoIj7XsQMR+NQYd7XfdtPAew++Mz6LnbXpt9woxLWmEAW8Anez05\r\nhP565OE9jmvbAI30HvahwMmN+om7GhLrFzRbFTsaaCEwnWfdbdnUmGbreKR/\r\nLy61XXvV8gU4/Biz3doqJp7q7jdRODiUTID/fYh1MomOaqK7Ny9Rwpkuzh3j\r\nEo+/9XU9JAIh0iSZqbQH+NpiBszfSh7D0YCdmZpI2ITJNU/79RAge6vV6pyc\r\nFsc0mk8wmGShQpDbmNJqUdjLuZNLpK3iPZ27R0sw/3FjvSCV6imjcfk9ZosC\r\nsstF7iJvG9EGz0R7W+KHarSoFHkq2P1qj05Ub1LRTTxdptd9lroXchcYJQMB\r\n8gHgvt2Q1CGJlMiHLJoGY4Smt7nFTwY/sAwCXlq8KQkJNaj7dka63U9lpWzn\r\n4feMeBjUeFbPEcFklbhArjN6OX6TZZlKkhQLzZOTQoMqXFxpfaMLOae4yICl\r\n5NZyIHiXaTnXQ1X8B+uJWtbLgEdaZkPkcAo7fAayUohHF7Acm8sLrpk1JPrw\r\nKc5LHEoqiZ0BPKFbG+D+/XqrFuq7PbrmVz0=\r\n=+/rH\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_1.0.0-next.0_1656878185541_0.4324956145936074"},"_hasShrinkwrap":false},"1.0.0-next.1":{"name":"next-connect","version":"1.0.0-next.1","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","exports":{"import":{"types":"./dist/types/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/types/index.d.ts","default":"./dist/commonjs/index.cjs"}},"main":"./dist/commonjs/index.cjs","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","sideEffects":false,"scripts":{"build:esm":"tsc --outDir ./dist/esm","build:commonjs":"tsc --outDir ./dist/commonjs --module commonjs && node ./scripts/rename-cjs-extenstion.js ./dist/commonjs","build:types":"tsc --outDir ./dist/types --declaration --emitDeclarationOnly","build":"npm run build:esm && npm run build:commonjs && npm run build:types","test":"c8 tap","prepublishOnly":"npm run clean && npm run test && npm run build","coverage":"c8 report --reporter=lcov","lint":"eslint ./src --ext json,ts --ignore-path .gitignore","format":"prettier . -w --ignore-path ./.gitignore","clean":"rm -rf ./dist"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@tsconfig/node14":"^1.0.3","@types/node":"^18.0.0","@types/tap":"^15.0.7","@typescript-eslint/eslint-plugin":"^5.30.3","@typescript-eslint/parser":"^5.30.3","c8":"^7.11.3","eslint":"^8.19.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.7.1","tap":"^16.3.0","tinyspy":"^1.0.0","ts-node":"^10.8.1","typescript":"^4.7.4"},"tap":{"node-arg":["--loader","ts-node/esm"],"coverage":false},"dependencies":{"regexparam":"^2.0.1"},"engines":{"node":">=12.22.0"},"gitHead":"8823836a74c43e2e6fa5f7be181eabf34a79a4f6","_id":"next-connect@1.0.0-next.1","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-BK9bKKarQk6bYODcHfbRP+e94bP11PWhAyji21+oZHiLCZw7a55NBzO5Rne5taLUi6AG7Utajp4Y9CE2FmDhlQ==","shasum":"4cd93bfd12a13ccbab2b47dcf8f93a048423b428","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-1.0.0-next.1.tgz","fileCount":15,"unpackedSize":33381,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChBlHS0zxTDGQ4/WpcX83398r+ZxI6wXOBCVlw/bGnVwIhAOebEv+Pxviw5QqCGayuXrdbFc3M/Die68BEPnVSqQlC"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJixRrFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqpCQ//YZ16u4KTBJvS98dO+XA3YYDxRd1dUTxpjinTvs1E98jXTPGa\r\ns2Dr42HIO21S18ZHpN/sRuEeyPly7odboOIgo4QCZcNAug4NQRZRs3+7pejZ\r\nzOC8Ll2EguhtN8iFW4klFfsgEikyvcpJ7GzMbXz1HeLPS5gQyiIfSlknKpHp\r\nl+U5jo6MMaoKjX9BQ4UZuWNT3oMLWEo7ih4EbIMhtyBOaB+wRAjOifAtafpX\r\n72uG8J9zsSiiehwfFQ2KQMXyC+vIKqmQP8Nc279IPYNJ7gvW3YX76bzn7r//\r\n5rnen0+QsAwpaoxGKmCFtgekyjxH2iuJae1oToA05Cv7sOO+P7Rkfv2jmCJd\r\nwtN7SLvMhnzWEIf+mhFOLoOc9e0CQNOJciAk+J3zBLjQ4F/GdYEkLvce/B8X\r\n0ZC5u1c9CuGUPHFjQSK/eYwyaYJYihkw9WlRh+mzZY4AuaF/mV+p/2MD0Ki6\r\nX3o1DmX8+lytP6uEC1bkRfw2t3eG0PwqXn1UT8AKBMJ2ePYnhJlJdz6f5a0k\r\nwnZvN1pyzTfid4eV5wJpPH0GI0IeTP59nTgndTPO24yoDDyeTYILK0qHBQ6w\r\nlO8VDSmu9bg6KNYzWKoy+LeQghyhfEz5ckTFexlzINuKQ8eKvjdG+inebvRd\r\nFjuLMXO9a7Qb033yOgZ+fdVruUf5qzPVbrE=\r\n=wS7F\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_1.0.0-next.1_1657084613226_0.832928826012328"},"_hasShrinkwrap":false,"deprecated":"npm i next-connect@next instead"},"1.0.0-next.2":{"name":"next-connect","version":"1.0.0-next.2","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","exports":{"import":{"types":"./dist/types/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/types/index.d.ts","default":"./dist/commonjs/index.cjs"}},"main":"./dist/commonjs/index.cjs","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","sideEffects":false,"scripts":{"build:esm":"tsc --outDir ./dist/esm","build:commonjs":"tsc --outDir ./dist/commonjs --module commonjs && node ./scripts/rename-cjs-extenstion.js ./dist/commonjs","build:types":"tsc --outDir ./dist/types --declaration --emitDeclarationOnly","build":"npm run build:esm && npm run build:commonjs && npm run build:types","test":"c8 tap","prepublishOnly":"npm run clean && npm run test && npm run build","coverage":"c8 report --reporter=lcov","lint":"eslint ./src --ext json,ts --ignore-path .gitignore","format":"prettier . -w --ignore-path ./.gitignore","clean":"rm -rf ./dist"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@tsconfig/node14":"^1.0.3","@types/node":"^18.0.0","@types/tap":"^15.0.7","@typescript-eslint/eslint-plugin":"^5.30.3","@typescript-eslint/parser":"^5.30.3","c8":"^7.11.3","eslint":"^8.19.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.7.1","tap":"^16.3.0","tinyspy":"^1.0.0","ts-node":"^10.8.1","typescript":"^4.7.4"},"tap":{"node-arg":["--loader","ts-node/esm"],"coverage":false},"dependencies":{"regexparam":"^2.0.1"},"engines":{"node":">=12.22.0"},"readme":"# next-connect\n\n[![npm](https://badgen.net/npm/v/next-connect)](https://www.npmjs.com/package/next-connect)\n[![CircleCI](https://circleci.com/gh/hoangvvo/next-connect.svg?style=svg)](https://circleci.com/gh/hoangvvo/next-connect)\n[![codecov](https://codecov.io/gh/hoangvvo/next-connect/branch/main/graph/badge.svg?token=LGIyl3Ti4H)](https://codecov.io/gh/hoangvvo/next-connect)\n[![minified size](https://badgen.net/bundlephobia/min/next-connect)](https://bundlephobia.com/result?p=next-connect)\n[![download/year](https://badgen.net/npm/dy/next-connect)](https://www.npmjs.com/package/next-connect)\n\nThe promise-based method routing and middleware layer for [Next.js](https://nextjs.org/) and many other frameworks.\n\n> **Warning**\n> v1 is a complete rewrite of v0 and is not backward-compatible. See [Releases](https://github.com/hoangvvo/next-connect/releases) to learn about the changes.\n\n> [v0](https://github.com/hoangvvo/next-connect/tree/v0), which is written to be compatible with Express.js middleware, is still maintained with bug fixes. v1 drops explicit support for Express.js middleware, but still provide a way to use them through a wrapper (see below)\n\n## Features\n\n- Async middleware\n- [Lightweight](https://bundlephobia.com/scan-results?packages=express,next-connect,koa,micro) => Suitable for serverless environment\n- [way faster](https://github.com/hoangvvo/next-connect/tree/main/bench) than Express.js. Compatible with Express.js via [a wrapper](#expressjs-compatibility).\n- Works with async handlers (with error catching)\n- TypeScript support\n\n## Installation\n\n```sh\nnpm install next-connect@next\n```\n\n## Usage\n\n> **Note**\n>\n> Although `next-connect` is initially written for Next.js, it can be used in [http server](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener), [Vercel](https://vercel.com/docs/concepts/functions/serverless-functions). See [Examples](./examples/) for more integrations.\n\nBelow are some use cases.\n\n### Next.js API Routes\n\n```typescript\n// pages/api/hello.js\nimport type { NextApiRequest, NextApiResponse } from \"next\";\nimport { createRouter } from \"next-connect\";\n\n// Default Req and Res are IncomingMessage and ServerResponse\n// You may want to pass in NextApiRequest and NextApiResponse\nconst router = createRouter<NextApiRequest, NextApiResponse>();\n\nrouter\n  .use(async (req, res, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .use(authMiddleware)\n  .get((req, res) => {\n    res.send(\"Hello world\");\n  })\n  .post(async (req, res) => {\n    // use async/await\n    const user = await insertUser(req.body.user);\n    res.json({ user });\n  })\n  .put(\n    async (req, res, next) => {\n      // You may want to pass in NextApiRequest & { isLoggedIn: true }\n      // in createRouter generics to define this extra property\n      if (!req.isLoggedIn) throw new Error(\"thrown stuff will be caught\");\n      // go to the next in chain\n      return next();\n    },\n    async (req, res) => {\n      const user = await updateUser(req.body.user);\n      res.json({ user });\n    }\n  );\n\n// create a handler from router with custom\n// onError and onNoMatch\nexport default router.handler({\n  onError: (err, req, res) => {\n    console.error(err.stack);\n    res.status(500).end(\"Something broke!\");\n  },\n  onNoMatch: (req, res) => {\n    res.status(404).end(\"Page is not found\");\n  },\n});\n```\n\n### Next.js Edge API Routes (Beta)\n\nEdge Router can be used in [Edge Runtime](https://nextjs.org/docs/api-reference/edge-runtime)\n\n```ts\nimport type { NextFetchEvent, NextRequest } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\n\n// Default Req and Evt are Request and unknown\n// You may want to pass in NextRequest and NextFetchEvent\nconst router = createEdgeRouter<NextRequest, NextFetchEvent>();\n\nrouter\n  .use(async (req, evt, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .use(authMiddleware)\n  .get((req, res) => {\n    return new Response(\"Hello world\");\n  })\n  .post(async (req, res) => {\n    // use async/await\n    const user = await insertUser(req.body.user);\n    res.json({ user });\n    return new Response(JSON.stringify({ user }), {\n      status: 200,\n      headers: {\n        \"content-type\": \"application/json\",\n      },\n    });\n  })\n  .put(async (req, res) => {\n    const user = await updateUser(req.body.user);\n    return new Response(JSON.stringify({ user }), {\n      status: 200,\n      headers: {\n        \"content-type\": \"application/json\",\n      },\n    });\n  });\n\n// create a handler from router with custom\n// onError and onNoMatch\nexport default router.handler({\n  onError: (err, req, evt) => {\n    console.error(err.stack);\n    return new NextResponse(\"Something broke!\", {\n      status: 500,\n    });\n  },\n  onNoMatch: (req, res) => {\n    return new NextResponse(\"Page is not found\", {\n      status: 404,\n    });\n  },\n});\n```\n\n### Next.js getServerSideProps\n\n```jsx\n// page/users/[id].js\nimport { createRouter } from \"next-connect\";\n\nexport default function Page({ user, updated }) {\n  return (\n    <div>\n      {updated && <p>User has been updated</p>}\n      <div>{JSON.stringify(user)}</div>\n      <form method=\"POST\">{/* User update form */}</form>\n    </div>\n  );\n}\n\nconst router = createRouter()\n  .use(async (req, res, next) => {\n    logRequest(req);\n    return next();\n  })\n  .get(async (req, res) => {\n    const user = await getUser(req.params.id);\n    if (!user) {\n      // https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#notfound\n      return { props: { notFound: true } };\n    }\n    return { props: { user } };\n  })\n  .post(async (req, res) => {\n    const user = await updateUser(req);\n    return { props: { user, updated: true } };\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  try {\n    // we await here so that the error can be caught below\n    // rather than propagate to the outer layer\n    return await router.run(req, res);\n  } catch (e) {\n    // handle the error\n    return {\n      props: { error: e.message },\n    };\n  }\n}\n```\n\n## API\n\nThe following APIs are rewritten in term of `NodeRouter` (`createRouter`), but they apply to `EdgeRouter` (`createEdgeRouter`) as well.\n\n### router = createRouter(options)\n\nCreate an instance Node.js router.\n\n### router.use(base, ...fn)\n\n`base` (optional) - match all routes to the right of `base` or match all if omitted. (Note: If used in Next.js, this is often omitted)\n\n`fn`(s) can either be:\n\n- functions of `(req, res[, next])`\n- **or** a router instance\n\n```javascript\n// Mount a middleware function\nrouter1.use(async (req, res, next) => {\n  req.hello = \"world\";\n  await next(); // call to proceed to the next in chain\n  console.log(\"request is done\"); // call after all downstream handler has run\n});\n\n// Or include a base\nrouter2.use(\"/foo\", fn); // Only run in /foo/**\n\n// mount an instance of router\nconst sub1 = createRouter().use(fn1, fn2);\nconst sub2 = createRouter().use(\"/dashboard\", auth);\nconst sub3 = createRouter()\n  .use(\"/waldo\", subby)\n  .get(getty)\n  .post(\"/baz\", posty)\n  .put(\"/\", putty);\nrouter3\n  // - fn1 and fn2 always run\n  // - auth runs only on /dashboard\n  .use(sub1, sub2)\n  // `subby` runs on ANY /foo/waldo?/*\n  // `getty` runs on GET /foo/*\n  // `posty` runs on POST /foo/baz\n  // `putty` runs on PUT /foo\n  .use(\"/foo\", sub3);\n```\n\n### router.METHOD(pattern, ...fns)\n\n`METHOD` is an HTTP method (`GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `TRACE`) in lowercase.\n\n`pattern` (optional) - match routes based on [supported pattern](https://github.com/lukeed/regexparam#regexparam-) or match any if omitted.\n\n`fn`(s) are functions of `(req, res[, next])`.\n\n```javascript\nrouter.get(\"/api/user\", (req, res, next) => {\n  res.json(req.user);\n});\nrouter.post(\"/api/users\", (req, res, next) => {\n  res.end(\"User created\");\n});\nrouter.put(\"/api/user/:id\", (req, res, next) => {\n  // https://nextjs.org/docs/routing/dynamic-routes\n  res.end(`User ${req.params.id} updated`);\n});\n\n// Next.js already handles routing (including dynamic routes), we often\n// omit `pattern` in `.METHOD`\nrouter.get((req, res, next) => {\n  res.end(\"This matches whatever route\");\n});\n```\n\n> **Note**\n> You should understand Next.js [file-system based routing](https://nextjs.org/docs/routing/introduction). For example, having a `router.put(\"/api/foo\", handler)` inside `page/api/index.js` _does not_ serve that handler at `/api/foo`.\n\n### router.all(pattern, ...fns)\n\nSame as [.METHOD](#methodpattern-fns) but accepts _any_ methods.\n\n### router.handler(options)\n\nCreate a handler to handle incoming requests.\n\n**options.onError**\n\nAccepts a function as a catch-all error handler; executed whenever a handler throws an error.\nBy default, it responds with a generic `500 Internal Server Error` while logging the error to `console`.\n\n```javascript\nfunction onError(err, req, res) {\n  logger.log(err);\n  // OR: console.error(err);\n\n  res.status(500).end(\"Internal server error\");\n}\n\nexport default router.handler({ onError });\n```\n\n**options.onNoMatch**\n\nAccepts a function of `(req, res)` as a handler when no route is matched.\nBy default, it responds with a `404` status and a `Route [Method] [Url] not found` body.\n\n```javascript\nfunction onNoMatch(req, res) {\n  res.status(404).end(\"page is not found... or is it!?\");\n}\n\nexport default router.handler({ onNoMatch });\n```\n\n### router.run(req, res)\n\nRuns `req` and `res` through the middleware chain and returns a **promise**. It resolves with the value returned from handlers.\n\n```js\nrouter\n  .use(async (req, res, next) => {\n    return (await next()) + 1;\n  })\n  .use(async () => {\n    return (await next()) + 2;\n  })\n  .use(async () => {\n    return 3;\n  });\n\nconsole.log(await router.run(req, res));\n// The above will print \"6\"\n```\n\nThis can be useful in [`getServerSideProps`](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering).\n\n## Common errors\n\nThere are some pitfalls in using `next-connect`. Below are things to keep in mind to use it correctly.\n\n1. **Always** `await next()`\n\nIf `next()` is not awaited, errors will not be caught if they are thrown in async handlers, leading to `UnhandledPromiseRejection`.\n\n```javascript\n// OK: we don't use async so no need to await\nrouter\n  .use((req, res, next) => {\n    next();\n  })\n  .use((req, res, next) => {\n    next();\n  })\n  .use(() => {\n    throw new Error(\"💥\");\n  });\n\n// BAD: This will lead to UnhandledPromiseRejection\nrouter\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n  });\n\n// GOOD\nrouter\n  .use(async (req, res, next) => {\n    await next(); // next() is awaited, so errors are caught properly\n  })\n  .use((req, res, next) => {\n    return next(); // this works as well since we forward the rejected promise\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n    // return new Promise.reject(\"💥\");\n  });\n```\n\nAnother issue is that the handler would resolve before all the code in each layer runs.\n\n```javascript\nconst handler = router\n  .use(async (req, res, next) => {\n    next(); // this is not returned or await\n  })\n  .get(async () => {\n    // simulate a long task\n    await new Promise((resolve) => setTimeout(resolve, 1000));\n    res.send(\"ok\");\n    console.log(\"request is completed\");\n  })\n  .handler();\n\nawait handler(req, res);\nconsole.log(\"finally\"); // this will run before the get layer gets to finish\n\n// This will result in:\n// 1) \"finally\"\n// 2) \"request is completed\"\n```\n\n2. **DO NOT** reuse the same instance of `router` like the below pattern:\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.get(x).handler();\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.get(y).handler();\n```\n\nThis is because, in each API Route, the same router instance is mutated, leading to undefined behaviors.\nIf you want to achieve something like that, you can use `router.clone` to return different instances with the same routes populated.\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(x).handler();\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(y).handler();\n```\n\n3. **DO NOT** use response function like `res.(s)end` or `res.redirect` inside `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst handler = createRouter()\n  .use((req, res) => {\n    // BAD: res.redirect is not a function (not defined in `getServerSideProps`)\n    // See https://github.com/hoangvvo/next-connect/issues/194#issuecomment-1172961741 for a solution\n    res.redirect(\"foo\");\n  })\n  .use((req, res) => {\n    // BAD: `getServerSideProps` gives undefined behavior if we try to send a response\n    res.end(\"bar\");\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  await router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n3. **DO NOT** use `handler()` directly in `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst router = createRouter().use(foo).use(bar);\nconst handler = router.handler();\n\nexport async function getServerSideProps({ req, res }) {\n  await handler(req, res); // BAD: You should call router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n## Recipes\n\n### Next.js\n\n<details>\n<summary>Match multiple routes</summary>\n\nIf you created the file `/api/<specific route>.js` folder, the handler will only run on that specific route.\n\nIf you need to create all handlers for all routes in one file (similar to `Express.js`). You can use [Optional catch-all API routes](https://nextjs.org/docs/api-routes/dynamic-api-routes#optional-catch-all-api-routes).\n\n```javascript\n// pages/api/[[...slug]].js\nimport { createRouter } from \"next-connect\";\n\nconst router = createRouter()\n  .use(\"/api/hello\", someMiddleware())\n  .get(\"/api/user/:userId\", (req, res) => {\n    res.send(`Hello ${req.params.userId}`);\n  });\n\nexport default router.handler();\n```\n\nWhile this allows quick migration from Express.js, consider seperating routes into different files (`/api/user/[userId].js`, `/api/hello.js`) in the future.\n\n</details>\n\n### Express.js Compatibility\n\n<details>\n<summary>Middleware wrapper</summary>\n\nExpress middleware is not built around promises but callbacks. This prevents it from playing well in the `next-connect` model. Understanding the way express middleware works, we can build a wrapper like the below:\n\n```js\nimport someExpressMiddleware from \"some-express-middleware\";\n\nconst expressWrapper = (middleware) => {\n  return async (req, res, next) => {\n    await new Promise((resolve, reject) => {\n      middleware(req, res, (err) => (err ? reject(err) : resolve()));\n    });\n    return next();\n  };\n};\n\nrouter.use(expressWrapper(someExpressMiddleware));\n```\n\n</details>\n\n## Contributing\n\nPlease see my [contributing.md](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"c5e181494e0fa96180c54520470cd33958f9184d","_id":"next-connect@1.0.0-next.2","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-ywre1m3Hk06R6/bJXCyqwnAM+cB/w5rD1SVpa88nGEEsYUUzH1hZmqEkzPOb7VXkKUYzvtgqYxZs/FAtMFw+3g==","shasum":"de229caac34597a774540bbfdbe6dd9ec23855e9","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-1.0.0-next.2.tgz","fileCount":18,"unpackedSize":39928,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2Hvhm15QeMlzQpzA3u7MHdl//7uAUWzq8oEYgOJNaIgIhANzYpmj9ukZHAiEoP975A7UXizOvwpaLZnoB9uHW036h"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJixY+eACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoenhAAnRd70U9vtCjXyNMHzXCm4DWfzNRHzJKhfVQoclkkdlIvpzYF\r\nHnWgrJLEyrEvdqCXeY0jKONhveL39Y7dBoXMUO47zOKJyNySwqfykrX/da+I\r\n8Aq7NG0e0gxUrQ8xrToyud1T+QsbC3VHz/6tXJEAi+qEiXYZl2k8bdxh8izT\r\nfYc0vUJhhdwqibpkQlhIc3498XU2ZbVWgUrCaG9SFKb1sxQ2yuBUGaoDmcZ/\r\ngW4aO9uwc26knpd7Q/5uK41QY6qTOvf8kFVB13iEORrl2ZsbDLKQd/pMHT3f\r\nEjx73VbS0PvlDtIUeFqrKEYqiEQ2KC+i9pR5d89FSTvnlJotzXJqG/5HderY\r\n6ikEppSC+gHRJvwjoUJhjTVmKOo4RO+kIqDZd8hjutiNjmcytPfNU3SMNSuF\r\nYDiFEDz+a2iwN0v9uAh9wuLgEPZ0p4r4zPixVKeornhGG2j9eoJtNYW4ZaT5\r\n9InRMwvv9YN3YG8w42Dw+ovadMACsI+m2l6zvpdO0JqP8E3xlQyWtbxTQbR9\r\nWIxVL3l6msms8G2VlWbVQZXYOay3Nb/8sQ8hV4bG1UvuNws0jIDl+TI5RgSe\r\ng2vrqR/MJaluitzfgdSIAXqDcvlheEWcJbK9DuiPaOuHu6v8ATmUcDo3+2v9\r\ncYoC4MR7qhk4cPoxQJajLB3kkT5yr716Ka0=\r\n=uEeY\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_1.0.0-next.2_1657114526096_0.3064344355570887"},"_hasShrinkwrap":false},"1.0.0-next.3":{"name":"next-connect","version":"1.0.0-next.3","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","exports":{"import":{"types":"./dist/types/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/types/index.d.ts","default":"./dist/commonjs/index.cjs"}},"main":"./dist/commonjs/index.cjs","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","sideEffects":false,"scripts":{"build":"tscd --entry index.js","test":"c8 tap","prepublishOnly":"npm run clean && npm run test && npm run build","coverage":"c8 report --reporter=lcov","lint":"eslint ./src --ext json,ts --ignore-path .gitignore","format":"prettier . -w --ignore-path ./.gitignore","clean":"rm -rf ./dist"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@tsconfig/node14":"^1.0.3","@types/node":"^18.0.0","@types/tap":"^15.0.7","@typescript-eslint/eslint-plugin":"^5.30.3","@typescript-eslint/parser":"^5.30.3","c8":"^7.11.3","eslint":"^8.19.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.7.1","tap":"^16.3.0","tinyspy":"^1.0.0","ts-node":"^10.8.1","tscd":"^0.0.3","typescript":"^4.7.4"},"tap":{"node-arg":["--loader","ts-node/esm"],"coverage":false},"dependencies":{"regexparam":"^2.0.1"},"engines":{"node":">=12.22.0"},"readme":"# next-connect\n\n[![npm](https://badgen.net/npm/v/next-connect)](https://www.npmjs.com/package/next-connect)\n[![CircleCI](https://circleci.com/gh/hoangvvo/next-connect.svg?style=svg)](https://circleci.com/gh/hoangvvo/next-connect)\n[![codecov](https://codecov.io/gh/hoangvvo/next-connect/branch/main/graph/badge.svg?token=LGIyl3Ti4H)](https://codecov.io/gh/hoangvvo/next-connect)\n[![minified size](https://badgen.net/bundlephobia/min/next-connect)](https://bundlephobia.com/result?p=next-connect)\n[![download/year](https://badgen.net/npm/dy/next-connect)](https://www.npmjs.com/package/next-connect)\n\nThe promise-based method routing and middleware layer for [Next.js](https://nextjs.org/) (API Routes, Edge API Routes, getServerSideProps, Middleware) and many other frameworks.\n\n> **Warning**\n> v1 is a complete rewrite of v0 and is **not** backward-compatible. See [Releases](https://github.com/hoangvvo/next-connect/releases) to learn about the changes.\n\n> [v0](https://github.com/hoangvvo/next-connect/tree/v0), which is written to be compatible with Express.js middleware, is still maintained with bug fixes. v1 drops explicit support for Express.js middleware, but still provide a way to use them through a wrapper (see below)\n\n## Features\n\n- Async middleware\n- [Lightweight](https://bundlephobia.com/scan-results?packages=express,next-connect,koa,micro) => Suitable for serverless environment\n- [way faster](https://github.com/hoangvvo/next-connect/tree/main/bench) than Express.js. Compatible with Express.js via [a wrapper](#expressjs-compatibility).\n- Works with async handlers (with error catching)\n- TypeScript support\n\n## Installation\n\n```sh\nnpm install next-connect@next\n```\n\n## Usage\n\n> **Note**\n>\n> Although `next-connect` is initially written for Next.js, it can be used in [http server](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener), [Vercel](https://vercel.com/docs/concepts/functions/serverless-functions). See [Examples](./examples/) for more integrations.\n\nBelow are some use cases.\n\n### Next.js API Routes\n\n```typescript\n// pages/api/hello.js\nimport type { NextApiRequest, NextApiResponse } from \"next\";\nimport { createRouter, expressWrapper } from \"next-connect\";\nimport cors from \"cors\";\n\n// Default Req and Res are IncomingMessage and ServerResponse\n// You may want to pass in NextApiRequest and NextApiResponse\nconst router = createRouter<NextApiRequest, NextApiResponse>();\n\nrouter\n  .use(expressWrapper(cors())) // express middleware are supported if you wrap it with expressWrapper\n  .use(async (req, res, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .get((req, res) => {\n    res.send(\"Hello world\");\n  })\n  .post(async (req, res) => {\n    // use async/await\n    const user = await insertUser(req.body.user);\n    res.json({ user });\n  })\n  .put(\n    async (req, res, next) => {\n      // You may want to pass in NextApiRequest & { isLoggedIn: true }\n      // in createRouter generics to define this extra property\n      if (!req.isLoggedIn) throw new Error(\"thrown stuff will be caught\");\n      // go to the next in chain\n      return next();\n    },\n    async (req, res) => {\n      const user = await updateUser(req.body.user);\n      res.json({ user });\n    }\n  );\n\n// create a handler from router with custom\n// onError and onNoMatch\nexport default router.handler({\n  onError: (err, req, res) => {\n    console.error(err.stack);\n    res.status(500).end(\"Something broke!\");\n  },\n  onNoMatch: (req, res) => {\n    res.status(404).end(\"Page is not found\");\n  },\n});\n```\n\n### Next.js getServerSideProps\n\n```jsx\n// page/users/[id].js\nimport { createRouter } from \"next-connect\";\n\nexport default function Page({ user, updated }) {\n  return (\n    <div>\n      {updated && <p>User has been updated</p>}\n      <div>{JSON.stringify(user)}</div>\n      <form method=\"POST\">{/* User update form */}</form>\n    </div>\n  );\n}\n\nconst router = createRouter()\n  .use(async (req, res, next) => {\n    // this serve as the error handling middleware\n    try {\n      return await next();\n    } catch (e) {\n      return {\n        props: { error: e.message },\n      };\n    }\n  })\n  .use(async (req, res, next) => {\n    logRequest(req);\n    return next();\n  })\n  .get(async (req, res) => {\n    const user = await getUser(req.params.id);\n    if (!user) {\n      // https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#notfound\n      return { props: { notFound: true } };\n    }\n    return { props: { user } };\n  })\n  .post(async (req, res) => {\n    const user = await updateUser(req);\n    return { props: { user, updated: true } };\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  return router.run(req, res);\n}\n```\n\n### Next.js Edge API Routes (Beta)\n\nEdge Router can be used in [Edge Runtime](https://nextjs.org/docs/api-reference/edge-runtime)\n\n```ts\nimport type { NextFetchEvent, NextRequest } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\nimport cors from \"cors\";\n\n// Default Req and Evt are Request and unknown\n// You may want to pass in NextRequest and NextFetchEvent\nconst router = createEdgeRouter<NextRequest, NextFetchEvent>();\n\nrouter\n  .use(expressWrapper(cors())) // express middleware are supported if you wrap it with expressWrapper\n  .use(async (req, evt, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .get((req, res) => {\n    return new Response(\"Hello world\");\n  })\n  .post(async (req, res) => {\n    // use async/await\n    const user = await insertUser(req.body.user);\n    res.json({ user });\n    return new Response(JSON.stringify({ user }), {\n      status: 200,\n      headers: {\n        \"content-type\": \"application/json\",\n      },\n    });\n  })\n  .put(async (req, res) => {\n    const user = await updateUser(req.body.user);\n    return new Response(JSON.stringify({ user }), {\n      status: 200,\n      headers: {\n        \"content-type\": \"application/json\",\n      },\n    });\n  });\n\n// create a handler from router with custom\n// onError and onNoMatch\nexport default router.handler({\n  onError: (err, req, evt) => {\n    console.error(err.stack);\n    return new NextResponse(\"Something broke!\", {\n      status: 500,\n    });\n  },\n  onNoMatch: (req, res) => {\n    return new NextResponse(\"Page is not found\", {\n      status: 404,\n    });\n  },\n});\n```\n\n### Next.js Middleware\n\nEdge Router can be used in [Next.js Middleware](https://nextjs.org/docs/advanced-features/middleware)\n\n```ts\n// middleware.ts\nimport { NextResponse } from \"next/server\";\nimport type { NextRequest, NextFetchEvent } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\n\n// This function can be marked `async` if using `await` inside\n\nconst router = createEdgeRouter<NextRequest, NextFetchEvent>();\n\nrouter.use(async (request, _, next) => {\n  await logRequest(request);\n  return next();\n});\n\nrouter.get(\"/about\", (request) => {\n  return NextResponse.redirect(new URL(\"/about-2\", request.url));\n});\n\nrouter.use(\"/dashboard\", (request) => {\n  if (!isAuthenticated(request)) {\n    return NextResponse.redirect(new URL(\"/login\", request.url));\n  }\n  return NextResponse.next();\n});\n\nrouter.all((request) => {\n  // default if none of the above matches\n  return NextResponse.next();\n});\n\nexport function middleware(request: NextRequest) {\n  return NextResponse.redirect(new URL(\"/about-2\", request.url));\n}\n```\n\n## API\n\nThe following APIs are rewritten in term of `NodeRouter` (`createRouter`), but they apply to `EdgeRouter` (`createEdgeRouter`) as well.\n\n### router = createRouter()\n\nCreate an instance Node.js router.\n\n### router.use(base, ...fn)\n\n`base` (optional) - match all routes to the right of `base` or match all if omitted. (Note: If used in Next.js, this is often omitted)\n\n`fn`(s) can either be:\n\n- functions of `(req, res[, next])`\n- **or** a router instance\n\n```javascript\n// Mount a middleware function\nrouter1.use(async (req, res, next) => {\n  req.hello = \"world\";\n  await next(); // call to proceed to the next in chain\n  console.log(\"request is done\"); // call after all downstream handler has run\n});\n\n// Or include a base\nrouter2.use(\"/foo\", fn); // Only run in /foo/**\n\n// mount an instance of router\nconst sub1 = createRouter().use(fn1, fn2);\nconst sub2 = createRouter().use(\"/dashboard\", auth);\nconst sub3 = createRouter()\n  .use(\"/waldo\", subby)\n  .get(getty)\n  .post(\"/baz\", posty)\n  .put(\"/\", putty);\nrouter3\n  // - fn1 and fn2 always run\n  // - auth runs only on /dashboard\n  .use(sub1, sub2)\n  // `subby` runs on ANY /foo/waldo?/*\n  // `getty` runs on GET /foo/*\n  // `posty` runs on POST /foo/baz\n  // `putty` runs on PUT /foo\n  .use(\"/foo\", sub3);\n```\n\n### router.METHOD(pattern, ...fns)\n\n`METHOD` is an HTTP method (`GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `TRACE`) in lowercase.\n\n`pattern` (optional) - match routes based on [supported pattern](https://github.com/lukeed/regexparam#regexparam-) or match any if omitted.\n\n`fn`(s) are functions of `(req, res[, next])`.\n\n```javascript\nrouter.get(\"/api/user\", (req, res, next) => {\n  res.json(req.user);\n});\nrouter.post(\"/api/users\", (req, res, next) => {\n  res.end(\"User created\");\n});\nrouter.put(\"/api/user/:id\", (req, res, next) => {\n  // https://nextjs.org/docs/routing/dynamic-routes\n  res.end(`User ${req.params.id} updated`);\n});\n\n// Next.js already handles routing (including dynamic routes), we often\n// omit `pattern` in `.METHOD`\nrouter.get((req, res, next) => {\n  res.end(\"This matches whatever route\");\n});\n```\n\n> **Note**\n> You should understand Next.js [file-system based routing](https://nextjs.org/docs/routing/introduction). For example, having a `router.put(\"/api/foo\", handler)` inside `page/api/index.js` _does not_ serve that handler at `/api/foo`.\n\n### router.all(pattern, ...fns)\n\nSame as [.METHOD](#methodpattern-fns) but accepts _any_ methods.\n\n### router.handler(options)\n\nCreate a handler to handle incoming requests.\n\n**options.onError**\n\nAccepts a function as a catch-all error handler; executed whenever a handler throws an error.\nBy default, it responds with a generic `500 Internal Server Error` while logging the error to `console`.\n\n```javascript\nfunction onError(err, req, res) {\n  logger.log(err);\n  // OR: console.error(err);\n\n  res.status(500).end(\"Internal server error\");\n}\n\nexport default router.handler({ onError });\n```\n\n**options.onNoMatch**\n\nAccepts a function of `(req, res)` as a handler when no route is matched.\nBy default, it responds with a `404` status and a `Route [Method] [Url] not found` body.\n\n```javascript\nfunction onNoMatch(req, res) {\n  res.status(404).end(\"page is not found... or is it!?\");\n}\n\nexport default router.handler({ onNoMatch });\n```\n\n### router.run(req, res)\n\nRuns `req` and `res` through the middleware chain and returns a **promise**. It resolves with the value returned from handlers.\n\n```js\nrouter\n  .use(async (req, res, next) => {\n    return (await next()) + 1;\n  })\n  .use(async () => {\n    return (await next()) + 2;\n  })\n  .use(async () => {\n    return 3;\n  });\n\nconsole.log(await router.run(req, res));\n// The above will print \"6\"\n```\n\nIf an error in thrown within the chain, `router.run` will reject. You can also add a try-catch in the first middleware to catch the error before it rejects the `.run()` call:\n\n```js\nrouter\n  .use(async (req, res, next) => {\n    return next().catch(errorHandler);\n  })\n  .use(thisMiddlewareMightThrow);\n\nawait router.run(req, res);\n```\n\n## Common errors\n\nThere are some pitfalls in using `next-connect`. Below are things to keep in mind to use it correctly.\n\n1. **Always** `await next()`\n\nIf `next()` is not awaited, errors will not be caught if they are thrown in async handlers, leading to `UnhandledPromiseRejection`.\n\n```javascript\n// OK: we don't use async so no need to await\nrouter\n  .use((req, res, next) => {\n    next();\n  })\n  .use((req, res, next) => {\n    next();\n  })\n  .use(() => {\n    throw new Error(\"💥\");\n  });\n\n// BAD: This will lead to UnhandledPromiseRejection\nrouter\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n  });\n\n// GOOD\nrouter\n  .use(async (req, res, next) => {\n    await next(); // next() is awaited, so errors are caught properly\n  })\n  .use((req, res, next) => {\n    return next(); // this works as well since we forward the rejected promise\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n    // return new Promise.reject(\"💥\");\n  });\n```\n\nAnother issue is that the handler would resolve before all the code in each layer runs.\n\n```javascript\nconst handler = router\n  .use(async (req, res, next) => {\n    next(); // this is not returned or await\n  })\n  .get(async () => {\n    // simulate a long task\n    await new Promise((resolve) => setTimeout(resolve, 1000));\n    res.send(\"ok\");\n    console.log(\"request is completed\");\n  })\n  .handler();\n\nawait handler(req, res);\nconsole.log(\"finally\"); // this will run before the get layer gets to finish\n\n// This will result in:\n// 1) \"finally\"\n// 2) \"request is completed\"\n```\n\n2. **DO NOT** reuse the same instance of `router` like the below pattern:\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.get(x).handler();\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.get(y).handler();\n```\n\nThis is because, in each API Route, the same router instance is mutated, leading to undefined behaviors.\nIf you want to achieve something like that, you can use `router.clone` to return different instances with the same routes populated.\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(x).handler();\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(y).handler();\n```\n\n3. **DO NOT** use response function like `res.(s)end` or `res.redirect` inside `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst handler = createRouter()\n  .use((req, res) => {\n    // BAD: res.redirect is not a function (not defined in `getServerSideProps`)\n    // See https://github.com/hoangvvo/next-connect/issues/194#issuecomment-1172961741 for a solution\n    res.redirect(\"foo\");\n  })\n  .use((req, res) => {\n    // BAD: `getServerSideProps` gives undefined behavior if we try to send a response\n    res.end(\"bar\");\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  await router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n3. **DO NOT** use `handler()` directly in `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst router = createRouter().use(foo).use(bar);\nconst handler = router.handler();\n\nexport async function getServerSideProps({ req, res }) {\n  await handler(req, res); // BAD: You should call router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n## Recipes\n\n### Next.js\n\n<details>\n<summary>Match multiple routes</summary>\n\nIf you created the file `/api/<specific route>.js` folder, the handler will only run on that specific route.\n\nIf you need to create all handlers for all routes in one file (similar to `Express.js`). You can use [Optional catch-all API routes](https://nextjs.org/docs/api-routes/dynamic-api-routes#optional-catch-all-api-routes).\n\n```javascript\n// pages/api/[[...slug]].js\nimport { createRouter } from \"next-connect\";\n\nconst router = createRouter()\n  .use(\"/api/hello\", someMiddleware())\n  .get(\"/api/user/:userId\", (req, res) => {\n    res.send(`Hello ${req.params.userId}`);\n  });\n\nexport default router.handler();\n```\n\nWhile this allows quick migration from Express.js, consider seperating routes into different files (`/api/user/[userId].js`, `/api/hello.js`) in the future.\n\n</details>\n\n### Express.js Compatibility\n\n<details>\n<summary>Middleware wrapper</summary>\n\nExpress middleware is not built around promises but callbacks. This prevents it from playing well in the `next-connect` model. Understanding the way express middleware works, we can build a wrapper like the below:\n\n```js\nimport { expressWrapper } from \"next-connect\";\nimport someExpressMiddleware from \"some-express-middleware\";\n\nrouter.use(expressWrapper(someExpressMiddleware));\n```\n\n</details>\n\n## Contributing\n\nPlease see my [contributing.md](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"e5ac7faf380a73114a2b6b07b0a43a01f8c1be36","_id":"next-connect@1.0.0-next.3","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-i1kb8rz/3lm6z68Lnh18juHGgbgFVZXXAIiElaASGXxDZ8mJ2EVxdbTXX8NiF9BbGDBeao7u6uKMqw5ZLZg/Kg==","shasum":"d7df4ee2c54bb1808f273e1ebec308e2ffb553d2","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-1.0.0-next.3.tgz","fileCount":21,"unpackedSize":46135,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBGFw3jMxZU4SmkB3MFEtuJePDyt59xMfNHBPudiJKUeAiEA1nzh4r28UmOxkhdSY5pJikfZ410bodWmlGTtchk4kzE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi283gACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoaIA//U5bfx19rxuvhqv6BXLpaU97az8nFr6MHNXSo/w/03QlV/eWt\r\nOlQrFKJeBt55omitzU4Y75qT+VNBRSNp+W3FQu5x778w2FtZ+GNuT2xS0pcn\r\nBLgQlnNyb7nmDu1Ft73SWR7e34hf6mFOEcTH0XyIJveZDtkoGZAYYy0eqvG4\r\nmAOQBOk3Rhc+r7NDsTfhPgWH0+0TRhFMhRNbm1I7lLsE2biBb569P9QyHpn7\r\nGVBwPXyvWXtwCubCS9CVfAzaHjZrtjJ5yPw+OKwsN5pMqXvn1cekPF3POqPX\r\njV837J/8XkQtRr0+HNL8zcbmIkNup5KrfoVfH32hcfiwxA9rTLf6h7k+tbmy\r\nNrnzcFogQd3uE/C1utnY+eV01KxlEK9VsYJje5IYGNsldRcU6RmAfWfB5Xnm\r\npFNb/CGFrhzGkZ4PRyw2HP+wiu7x09c5qrpuX9eJaDigSvc+7fT5KVlkHGPV\r\nhhvHnSpd/3nEmx3hmPIMMG5GGP6+iDdEQeuEo5O5Ui3StdKkJZnVqvDt87B2\r\nDyFNG2UDKGP6W/jGOahf9NQChQ07oD0jlrfClCfK+tOn2JiMf6aZ8NZ2+p11\r\niu080RBXQKlOb2hNmGBuPYlllQKSzySQevHiwBwf3TYFhoRW7WEupxTHKS/i\r\n4jCYPxhdF75JriloZ9EgTecgfLISbKWWOiU=\r\n=VfBk\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_1.0.0-next.3_1658572256575_0.8988095905676627"},"_hasShrinkwrap":false},"0.13.0":{"name":"next-connect","version":"0.13.0","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{"require":"./dist/index.cjs","import":"./dist/index.js"},"sideEffects":false,"scripts":{"lint":"eslint src -c .eslintrc --ext js","test":"c8 mocha","test-import":"cd test-import && npm i && npm start","build":"rollup --config","prepublishOnly":"npm run test && npm run build","coverage":"c8 report --reporter=text-lcov > coverage.lcov"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^18.0.6","c8":"^7.12.0","eslint":"^8.20.0","mocha":"^10.0.0","rollup":"^2.77.0","rollup-plugin-copy":"^3.4.0","supertest":"^6.2.4"},"dependencies":{"trouter":"^3.2.0"},"gitHead":"cda00e1af285391119b4f9c2d60de7e6b9aa12db","_id":"next-connect@0.13.0","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-f2G4edY01XomjCECSrgOpb/zzQinJO6Whd8Zds0+rLUYhj5cLwkh6FVvZsQCSSbxSc4k9nCwNuk5NLIhvO1gUA==","shasum":"dff835d2f5eab1f65503dae747dfef23c43020f0","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-0.13.0.tgz","fileCount":6,"unpackedSize":26039,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBxkjHdPmt7n4SofBjNuX6Xg9pmWTE6l5bAMQ/vMl17nAiEAvKPeGK3msdDmR+2sgdenDL/2WTuJ7vdP5a5mWlGNLdA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi298/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpavA//QbsWNVEq9eECmWK6rNVmQLaHMqeIyRKD1JevBOYTUyqbjbza\r\n0I54lv+I/soIdBqmr1DMNQ9NRnPYBOxHu8QbDIQ1oF1wj663Z9TFh4y2T2XZ\r\nlPIUWfbRisiI03vq2J1sc5sdXrFHsclQoot7HqlXCl9kW/es88nUMMkQXIIX\r\nMRiP3GmU7POOgPXYpcdRLrSAyHP4BDLaVopNuFvL62xAwe0rPyvTOhurLz4U\r\nMg8KhdLkejBP+uMeFEFyx6wjkIGxCclbTUgdCCeyUB7ep1HnyDSo1X+tXqWn\r\npi9FOWAmM3TrljZHRTqGsb809BN5Qq/AiSHo2DzOGNRT0VhGJmORcWqUE5w4\r\nH+kTlkkUqCnfMuZ4Bj3e5SB1xw3QIl5fmMMYOT2FtBmhcOVS4QFe3qXB2J8p\r\nbM9Tv04bucLXHCZqjj+8HAvPS+rIJklWAUMvwRG1FtOVmGBZwFB4G6mf0J15\r\nnz206+JP2oKuE4wXONBPN+zdZwXEMq5OhVpYXysePdZQQk7voEeKQIOKFxfm\r\nTnldbHm0HkAGmSBqifEEJl2wA9wKo1QLLylz1uBDHRaAIg5iT3Gsn0FPDoN6\r\nKEZU9VUOkdQecOEx1Bs9cPy7ZOc7YwVgRfp8DuRlhy8mtlRmlyUwA3/R8SZt\r\nF2n5BwcB8d8hZTTS6I05155Ab9jALX2/GmA=\r\n=Lq4S\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_0.13.0_1658576702613_0.6073380041122824"},"_hasShrinkwrap":false},"1.0.0-next.4":{"name":"next-connect","version":"1.0.0-next.4","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","exports":{"import":{"types":"./dist/types/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/types/index.d.ts","default":"./dist/commonjs/index.cjs"}},"main":"./dist/commonjs/index.cjs","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","sideEffects":false,"scripts":{"build":"tscd --entry index.js","test":"c8 tap","prepublishOnly":"npm run clean && npm run test && npm run build","coverage":"c8 report --reporter=lcov","lint":"eslint ./src --ext json,ts --ignore-path .gitignore","format":"prettier . -w --ignore-path ./.gitignore","clean":"rm -rf ./dist"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^18.16.3","@types/tap":"^15.0.8","@typescript-eslint/eslint-plugin":"^5.59.2","@typescript-eslint/parser":"^5.59.2","c8":"^7.13.0","eslint":"^8.39.0","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.8.8","tap":"^16.3.4","tinyspy":"^2.1.0","ts-node":"^10.9.1","tscd":"^0.0.5","typescript":"^5.0.4"},"tap":{"node-arg":["--loader","ts-node/esm"],"coverage":false},"dependencies":{"@tsconfig/node16":"^1.0.3","regexparam":"^2.0.1"},"engines":{"node":">=16"},"readme":"# next-connect\n\n[![npm](https://badgen.net/npm/v/next-connect)](https://www.npmjs.com/package/next-connect)\n[![CircleCI](https://circleci.com/gh/hoangvvo/next-connect.svg?style=svg)](https://circleci.com/gh/hoangvvo/next-connect)\n[![codecov](https://codecov.io/gh/hoangvvo/next-connect/branch/main/graph/badge.svg?token=LGIyl3Ti4H)](https://codecov.io/gh/hoangvvo/next-connect)\n[![minified size](https://badgen.net/bundlephobia/min/next-connect)](https://bundlephobia.com/result?p=next-connect)\n[![download/year](https://badgen.net/npm/dy/next-connect)](https://www.npmjs.com/package/next-connect)\n\nThe promise-based method routing and middleware layer for [Next.js](https://nextjs.org/) [API Routes](#nextjs-api-routes), [Edge API Routes](#nextjs-edge-api-routes), [Middleware](#nextjs-middleware), [Next.js App Router](#nextjs-app-router), and [getServerSideProps](#nextjs-getserversideprops).\n\n## Features\n\n- Async middleware\n- [Lightweight](https://bundlephobia.com/scan-results?packages=express,next-connect,koa,micro) => Suitable for serverless environment\n- [way faster](https://github.com/hoangvvo/next-connect/tree/main/bench) than Express.js. Compatible with Express.js via [a wrapper](#expressjs-compatibility).\n- Works with async handlers (with error catching)\n- TypeScript support\n\n## Installation\n\n```sh\nnpm install next-connect@next\n```\n\n## Usage\n\nAlso check out the [examples](./examples/) folder.\n\n### Next.js API Routes\n\n`next-connect` can be used in [API Routes](https://nextjs.org/docs/api-routes/introduction).\n\n```typescript\n// pages/api/user/[id].ts\nimport type { NextApiRequest, NextApiResponse } from \"next\";\nimport { createRouter, expressWrapper } from \"next-connect\";\nimport cors from \"cors\";\n\nconst router = createRouter<NextApiRequest, NextApiResponse>();\n\nrouter\n  // Use express middleware in next-connect with expressWrapper function\n  .use(expressWrapper(passport.session()))\n  // A middleware example\n  .use(async (req, res, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .get((req, res) => {\n    const user = getUser(req.query.id);\n    res.json({ user });\n  })\n  .put((req, res) => {\n    if (req.user.id !== req.query.id) {\n      throw new ForbiddenError(\"You can't update other user's profile\");\n    }\n    const user = await updateUser(req.body.user);\n    res.json({ user });\n  });\n\nexport const config = {\n  runtime: \"edge\",\n};\n\nexport default router.handler({\n  onError: (err, req, res) => {\n    console.error(err.stack);\n    res.status(err.statusCode || 500).end(err.message);\n  },\n});\n```\n\n### Next.js Edge API Routes\n\n`next-connect` can be used in [Edge API Routes](https://nextjs.org/docs/api-routes/edge-api-routes)\n\n```typescript\n// pages/api/user/[id].ts\nimport type { NextFetchEvent, NextRequest } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\nimport cors from \"cors\";\n\nconst router = createEdgeRouter<NextRequest, NextFetchEvent>();\n\nrouter\n  // A middleware example\n  .use(async (req, event, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .get((req) => {\n    const id = req.nextUrl.searchParams.get(\"id\");\n    const user = getUser(id);\n    return NextResponse.json({ user });\n  })\n  .put((req) => {\n    const id = req.nextUrl.searchParams.get(\"id\");\n    if (req.user.id !== id) {\n      throw new ForbiddenError(\"You can't update other user's profile\");\n    }\n    const user = await updateUser(req.body.user);\n    return NextResponse.json({ user });\n  });\n\nexport default router.handler({\n  onError: (err, req, event) => {\n    console.error(err.stack);\n    return new NextResponse(\"Something broke!\", {\n      status: err.statusCode || 500,\n    });\n  },\n});\n```\n\n### Next.js App Router\n\n`next-connect` can be used in [Next.js 13 Route Handler](https://beta.nextjs.org/docs/routing/route-handlers). The way handlers are written is almost the same to [Next.js Edge API Routes](#nextjs-edge-api-routes) by using `createEdgeRouter`.\n\n```typescript\n// app/api/user/[id].ts\n\nimport type { NextFetchEvent, NextRequest } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\nimport cors from \"cors\";\n\ninterface RequestContext {\n  params: {\n    id: string;\n  };\n}\n\nconst router = createEdgeRouter<NextRequest, RequestContext>();\n\nrouter\n  // A middleware example\n  .use(async (req, event, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .get((req) => {\n    const id = req.params.id;\n    const user = getUser(id);\n    return NextResponse.json({ user });\n  })\n  .put((req) => {\n    const id = req.params.id;\n    if (req.user.id !== id) {\n      throw new ForbiddenError(\"You can't update other user's profile\");\n    }\n    const user = await updateUser(req.body.user);\n    return NextResponse.json({ user });\n  });\n\nexport async function GET(request: NextRequest, ctx: RequestContext) {\n  return router.run(request, ctx);\n}\n\nexport async function PUT(request: NextRequest, ctx: RequestContext) {\n  return router.run(request, ctx);\n}\n```\n\n### Next.js Middleware\n\n`next-connect` can be used in [Next.js Middleware](https://nextjs.org/docs/advanced-features/middleware)\n\n```typescript\n// middleware.ts\nimport { NextResponse } from \"next/server\";\nimport type { NextRequest, NextFetchEvent } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\n\nconst router = createEdgeRouter<NextRequest, NextFetchEvent>();\n\nrouter.use(async (request, event, next) => {\n  // logging request example\n  console.log(`${request.method} ${request.url}`);\n  return next();\n});\n\nrouter.get(\"/about\", (request) => {\n  return NextResponse.redirect(new URL(\"/about-2\", request.url));\n});\n\nrouter.use(\"/dashboard\", (request) => {\n  if (!isAuthenticated(request)) {\n    return NextResponse.redirect(new URL(\"/login\", request.url));\n  }\n  return NextResponse.next();\n});\n\nrouter.all(() => {\n  // default if none of the above matches\n  return NextResponse.next();\n});\n\nexport function middleware(request: NextRequest, event: NextFetchEvent) {\n  return router.run(request, event);\n}\n\nexport const config = {\n  matcher: [\n    /*\n     * Match all request paths except for the ones starting with:\n     * - api (API routes)\n     * - _next/static (static files)\n     * - _next/image (image optimization files)\n     * - favicon.ico (favicon file)\n     */\n    \"/((?!api|_next/static|_next/image|favicon.ico).*)\",\n  ],\n};\n```\n\n### Next.js getServerSideProps\n\n`next-connect` can be used in [getServerSideProps](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props).\n\n```jsx\n// pages/users/[id].js\nimport { createRouter } from \"next-connect\";\n\nexport default function Page({ user, updated }) {\n  return (\n    <div>\n      {updated && <p>User has been updated</p>}\n      <div>{JSON.stringify(user)}</div>\n      <form method=\"POST\">{/* User update form */}</form>\n    </div>\n  );\n}\n\nconst router = createRouter()\n  .use(async (req, res, next) => {\n    // this serve as the error handling middleware\n    try {\n      return await next();\n    } catch (e) {\n      return {\n        props: { error: e.message },\n      };\n    }\n  })\n  .get(async (req, res) => {\n    const user = await getUser(req.params.id);\n    if (!user) {\n      // https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#notfound\n      return { props: { notFound: true } };\n    }\n    return { props: { user } };\n  })\n  .put(async (req, res) => {\n    const user = await updateUser(req);\n    return { props: { user, updated: true } };\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  return router.run(req, res);\n}\n```\n\n## API\n\nThe following APIs are rewritten in term of `NodeRouter` (`createRouter`), but they apply to `EdgeRouter` (`createEdgeRouter`) as well.\n\n### router = createRouter()\n\nCreate an instance Node.js router.\n\n### router.use(base, ...fn)\n\n`base` (optional) - match all routes to the right of `base` or match all if omitted. (Note: If used in Next.js, this is often omitted)\n\n`fn`(s) can either be:\n\n- functions of `(req, res[, next])`\n- **or** a router instance\n\n```javascript\n// Mount a middleware function\nrouter1.use(async (req, res, next) => {\n  req.hello = \"world\";\n  await next(); // call to proceed to the next in chain\n  console.log(\"request is done\"); // call after all downstream handler has run\n});\n\n// Or include a base\nrouter2.use(\"/foo\", fn); // Only run in /foo/**\n\n// mount an instance of router\nconst sub1 = createRouter().use(fn1, fn2);\nconst sub2 = createRouter().use(\"/dashboard\", auth);\nconst sub3 = createRouter()\n  .use(\"/waldo\", subby)\n  .get(getty)\n  .post(\"/baz\", posty)\n  .put(\"/\", putty);\nrouter3\n  // - fn1 and fn2 always run\n  // - auth runs only on /dashboard\n  .use(sub1, sub2)\n  // `subby` runs on ANY /foo/waldo?/*\n  // `getty` runs on GET /foo/*\n  // `posty` runs on POST /foo/baz\n  // `putty` runs on PUT /foo\n  .use(\"/foo\", sub3);\n```\n\n### router.METHOD(pattern, ...fns)\n\n`METHOD` is an HTTP method (`GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `TRACE`) in lowercase.\n\n`pattern` (optional) - match routes based on [supported pattern](https://github.com/lukeed/regexparam#regexparam-) or match any if omitted.\n\n`fn`(s) are functions of `(req, res[, next])`.\n\n```javascript\nrouter.get(\"/api/user\", (req, res, next) => {\n  res.json(req.user);\n});\nrouter.post(\"/api/users\", (req, res, next) => {\n  res.end(\"User created\");\n});\nrouter.put(\"/api/user/:id\", (req, res, next) => {\n  // https://nextjs.org/docs/routing/dynamic-routes\n  res.end(`User ${req.params.id} updated`);\n});\n\n// Next.js already handles routing (including dynamic routes), we often\n// omit `pattern` in `.METHOD`\nrouter.get((req, res, next) => {\n  res.end(\"This matches whatever route\");\n});\n```\n\n> **Note**\n> You should understand Next.js [file-system based routing](https://nextjs.org/docs/routing/introduction). For example, having a `router.put(\"/api/foo\", handler)` inside `page/api/index.js` _does not_ serve that handler at `/api/foo`.\n\n### router.all(pattern, ...fns)\n\nSame as [.METHOD](#methodpattern-fns) but accepts _any_ methods.\n\n### router.handler(options)\n\nCreate a handler to handle incoming requests.\n\n**options.onError**\n\nAccepts a function as a catch-all error handler; executed whenever a handler throws an error.\nBy default, it responds with a generic `500 Internal Server Error` while logging the error to `console`.\n\n```javascript\nfunction onError(err, req, res) {\n  logger.log(err);\n  // OR: console.error(err);\n\n  res.status(500).end(\"Internal server error\");\n}\n\nexport default router.handler({ onError });\n```\n\n**options.onNoMatch**\n\nAccepts a function of `(req, res)` as a handler when no route is matched.\nBy default, it responds with a `404` status and a `Route [Method] [Url] not found` body.\n\n```javascript\nfunction onNoMatch(req, res) {\n  res.status(404).end(\"page is not found... or is it!?\");\n}\n\nexport default router.handler({ onNoMatch });\n```\n\n### router.run(req, res)\n\nRuns `req` and `res` through the middleware chain and returns a **promise**. It resolves with the value returned from handlers.\n\n```js\nrouter\n  .use(async (req, res, next) => {\n    return (await next()) + 1;\n  })\n  .use(async () => {\n    return (await next()) + 2;\n  })\n  .use(async () => {\n    return 3;\n  });\n\nconsole.log(await router.run(req, res));\n// The above will print \"6\"\n```\n\nIf an error in thrown within the chain, `router.run` will reject. You can also add a try-catch in the first middleware to catch the error before it rejects the `.run()` call:\n\n```js\nrouter\n  .use(async (req, res, next) => {\n    return next().catch(errorHandler);\n  })\n  .use(thisMiddlewareMightThrow);\n\nawait router.run(req, res);\n```\n\n## Common errors\n\nThere are some pitfalls in using `next-connect`. Below are things to keep in mind to use it correctly.\n\n1. **Always** `await next()`\n\nIf `next()` is not awaited, errors will not be caught if they are thrown in async handlers, leading to `UnhandledPromiseRejection`.\n\n```javascript\n// OK: we don't use async so no need to await\nrouter\n  .use((req, res, next) => {\n    next();\n  })\n  .use((req, res, next) => {\n    next();\n  })\n  .use(() => {\n    throw new Error(\"💥\");\n  });\n\n// BAD: This will lead to UnhandledPromiseRejection\nrouter\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n  });\n\n// GOOD\nrouter\n  .use(async (req, res, next) => {\n    await next(); // next() is awaited, so errors are caught properly\n  })\n  .use((req, res, next) => {\n    return next(); // this works as well since we forward the rejected promise\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n    // return new Promise.reject(\"💥\");\n  });\n```\n\nAnother issue is that the handler would resolve before all the code in each layer runs.\n\n```javascript\nconst handler = router\n  .use(async (req, res, next) => {\n    next(); // this is not returned or await\n  })\n  .get(async () => {\n    // simulate a long task\n    await new Promise((resolve) => setTimeout(resolve, 1000));\n    res.send(\"ok\");\n    console.log(\"request is completed\");\n  })\n  .handler();\n\nawait handler(req, res);\nconsole.log(\"finally\"); // this will run before the get layer gets to finish\n\n// This will result in:\n// 1) \"finally\"\n// 2) \"request is completed\"\n```\n\n2. **DO NOT** reuse the same instance of `router` like the below pattern:\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.get(x).handler();\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.get(y).handler();\n```\n\nThis is because, in each API Route, the same router instance is mutated, leading to undefined behaviors.\nIf you want to achieve something like that, you can use `router.clone` to return different instances with the same routes populated.\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(x).handler();\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(y).handler();\n```\n\n3. **DO NOT** use response function like `res.(s)end` or `res.redirect` inside `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst handler = createRouter()\n  .use((req, res) => {\n    // BAD: res.redirect is not a function (not defined in `getServerSideProps`)\n    // See https://github.com/hoangvvo/next-connect/issues/194#issuecomment-1172961741 for a solution\n    res.redirect(\"foo\");\n  })\n  .use((req, res) => {\n    // BAD: `getServerSideProps` gives undefined behavior if we try to send a response\n    res.end(\"bar\");\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  await router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n3. **DO NOT** use `handler()` directly in `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst router = createRouter().use(foo).use(bar);\nconst handler = router.handler();\n\nexport async function getServerSideProps({ req, res }) {\n  await handler(req, res); // BAD: You should call router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n## Contributing\n\nPlease see my [contributing.md](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"2f675bba2029e1fc0f3d25d418895fbc26367126","_id":"next-connect@1.0.0-next.4","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-Iwfz4BgKyiU1E7PeF+kY0d3Ntjr6ZZv6SlOpQokBjaa4YmWv4zEuf/v5txFcoXDF9fSSjdzSzOQ6C+dQEQxkwA==","shasum":"2f75b8593ae40b197f30eefd809363d9da59d539","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-1.0.0-next.4.tgz","fileCount":21,"unpackedSize":44949,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDBIR6XTnHtekBUhhqZbmql4CRI3Npuq4rrETr7Mc6DCwIhAPT0Se26q4zBI9Mevwg65SH1IAdcDI2Z+ooUN9MS3Bsq"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkU504ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmzA//UmW9sCK2mWmdvntRv7Xd6s7r5zM6TqdIXa5GlSknL5oxXV5o\r\nk3zeT140s7YTaVs2XPEXKA71mt9iYZ0MXtZp/vGJGPWZW2LGRzjkAWwn0AGC\r\ngkpeXDsK0YYWrK8D4WnofoUnMKJEODZMH0tkGi61Xq/54iB0T/B+oK7Akt+i\r\n1DzRIJpul3Cx9yP1hMHQwqFD6FhUv8lKxn68ciajo5q4wALRKyNBmSkIHU/r\r\n8ENk+6A581Ak3zOibHFqolXZ3WnhsiyEwNjjrXgMKgXwwuLfKegm13KxHaUx\r\nusK9kLt8kncz2pHX/8dc9RvaIGs1XgJM4N8E9vq6Qs0Cpw2mdt/JC6JtHhj4\r\nRJOYyvkA5u7KzY/Dk5Ve7cDi891YkHDOUmJJdzXgb/TANm6Dv6CtLHr+CklM\r\nv8RSsEl7+xcY5PUkAWl0//oymEr+bbg9nnva8lLpU2uEMnyvrcuBvtAu7ZHt\r\nXL8Iww3GbQShVnU7gzWu9aKcu3VxK1ihaoMUETGdsCeaxS4MNxZolqH2s2I2\r\nw5Le3/AqdxxoF3yRhKsLSYIbMeJfgeocF/vISWmiyxHu8BEvuHF7VhkaSPzf\r\nYSJ24g8Yy1p353mI6000hDWROgEBxjWoNkWNBc0ftOzK9tH2GntbPHHgcKVL\r\neJQo33bcr6F5FbKrQ8MsWrMUZdbP4uwMUlE=\r\n=pn0b\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_1.0.0-next.4_1683201336102_0.6506791840904929"},"_hasShrinkwrap":false},"1.0.0":{"name":"next-connect","version":"1.0.0","description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"type":"module","exports":{"import":{"types":"./dist/types/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/types/index.d.ts","default":"./dist/commonjs/index.cjs"}},"main":"./dist/commonjs/index.cjs","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","sideEffects":false,"scripts":{"build":"tscd --entry index.js","test":"c8 tap","prepublishOnly":"npm run clean && npm run test && npm run build","coverage":"c8 report --reporter=lcov","lint":"eslint ./src --ext json,ts --ignore-path .gitignore","format":"prettier . -w --ignore-path ./.gitignore","clean":"rm -rf ./dist"},"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"},"homepage":"https://github.com/hoangvvo/next-connect#readme","license":"MIT","devDependencies":{"@types/node":"^18.16.3","@types/tap":"^15.0.8","@typescript-eslint/eslint-plugin":"^5.59.2","@typescript-eslint/parser":"^5.59.2","c8":"^7.13.0","eslint":"^8.39.0","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.8.8","tap":"^16.3.4","tinyspy":"^2.1.0","ts-node":"^10.9.1","tscd":"^0.0.5","typescript":"^5.0.4"},"tap":{"node-arg":["--loader","ts-node/esm"],"coverage":false},"dependencies":{"@tsconfig/node16":"^1.0.3","regexparam":"^2.0.1"},"engines":{"node":">=16"},"gitHead":"2f675bba2029e1fc0f3d25d418895fbc26367126","_id":"next-connect@1.0.0","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-FeLURm9MdvzY1SDUGE74tk66mukSqL6MAzxajW7Gqh6DZKBZLrXmXnGWtHJZXkfvoi+V/DUe9Hhtfkl4+nTlYA==","shasum":"49361a92b2d22db1cce73f94dfe793cd4b9e0106","tarball":"https://registry.npmjs.org/next-connect/-/next-connect-1.0.0.tgz","fileCount":21,"unpackedSize":44942,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID8j98zxCXhTnBeeVWlQ/GHPx2j5ui9ijC2t8Kn160IAAiEA67JmQNjz6ebeB4ofb1AXi3GFFICpe68N4BsZSTMlp2w="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkU5+ZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrgCA/+LHxOB1Tl100m0AygF8CVpIizuPWMh6+i2otkEQBdK5muKsmx\r\nQGtgmRRQF0NCKIA5tSr4oCv2grX7ytI0Uo8C3CBljfFrUvXtzQMM3HMXjL+m\r\nwZyZhwztv2M4qRzJeG0qJsZD/EtxFf/5a5dKDzZCVZu2cDN/WDsOuTcU6FPg\r\nGuRBqxWhHizjIsvm9q50a7a2RkHoYX1CWkIs0KnGit9QbNjuRovn1MwwLQOf\r\nLYGlwCnLDj2Y9XtDj0lkG3BNw7W8rnebKbCJB1WyEuU0UFyvJj9GIJfm5k8B\r\nEcY2OL5f8WVgdmFp3V45sDW6NQE2gIUOdb3D7GzYGH0RyIGMPzPSMwcnrSa7\r\n2zVVtKTpTm2TMB2X0KidcMjmAuxYxP65py3a2ua2WtzEDdGQVZKlMfz9VCXu\r\nSitl1u/uTGljxzsVApWd2jl4/N10NvQx68EXcA8TJM0eG1ZrGbdeie1/cOmN\r\nG0k7n7rrwdhhQ7RNj2MCA7/wxEryQQk7QVHycgTu4dNvGuTFgXAt2t5lZYDE\r\nvmINqvHh37gSi5mCv4XIIDleqcWbZVkYEuc1T2h8V/8IFMIcHdC5ksBGA8OV\r\n34HxKbTLvdYFN2x27Anr8vdRe8kcCLtQzTCS/YR1mAUpS4PuB3mVQX+IEtcE\r\nvZP7E6kkziVzLqyIITxCSzRW4SJxyIyeO0A=\r\n=4qvP\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-connect_1.0.0_1683201945052_0.30919757839103323"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-14T02:16:35.545Z","0.0.1":"2019-10-14T02:16:35.771Z","modified":"2023-05-04T12:05:45.353Z","0.1.0":"2019-10-15T04:12:50.837Z","0.2.0":"2019-10-19T07:55:18.515Z","0.3.0":"2019-10-25T00:24:19.340Z","0.4.0":"2019-10-27T15:03:16.280Z","0.5.0":"2019-11-07T04:56:04.603Z","0.5.1":"2019-11-17T00:38:51.781Z","0.5.2":"2020-01-09T04:50:08.321Z","0.6.0":"2020-01-18T07:11:12.742Z","0.6.1":"2020-03-25T21:31:37.742Z","0.6.2":"2020-04-13T13:49:38.424Z","0.6.3":"2020-04-13T16:02:56.315Z","0.6.4":"2020-04-18T23:16:02.836Z","0.6.5":"2020-04-24T19:19:55.707Z","0.6.6":"2020-05-08T01:18:50.722Z","0.7.0":"2020-06-04T02:21:39.813Z","0.7.1":"2020-06-08T17:37:54.881Z","0.7.2":"2020-06-26T01:32:06.554Z","0.8.0":"2020-07-01T06:59:05.499Z","0.8.1":"2020-07-06T08:00:37.881Z","0.9.0":"2020-09-05T18:27:14.948Z","0.9.1":"2020-10-22T00:35:23.329Z","0.10.0":"2021-02-14T19:05:07.517Z","0.10.1":"2021-03-16T15:20:10.549Z","0.10.2":"2021-08-04T15:34:09.625Z","0.11.0":"2021-10-19T04:28:39.575Z","0.11.1":"2022-02-03T10:55:05.608Z","0.12.0":"2022-02-05T09:41:36.890Z","0.12.1":"2022-02-07T18:56:31.088Z","0.12.2":"2022-02-20T05:57:50.420Z","1.0.0-next.0":"2022-07-03T19:56:25.749Z","1.0.0-next.1":"2022-07-06T05:16:53.379Z","1.0.0-next.2":"2022-07-06T13:35:26.352Z","1.0.0-next.3":"2022-07-23T10:30:56.787Z","0.13.0":"2022-07-23T11:45:02.978Z","1.0.0-next.4":"2023-05-04T11:55:36.243Z","1.0.0":"2023-05-04T12:05:45.231Z"},"maintainers":[{"name":"hoangvvo","email":"hoangvvo.dev@gmail.com"}],"description":"The method routing and middleware layer for Next.js (and many others)","keywords":["javascript","nextjs","middleware","router","connect"],"repository":{"type":"git","url":"git+https://github.com/hoangvvo/next-connect.git"},"author":{"name":"Hoang Vo","url":"https://www.hoangvvo.com"},"license":"MIT","readme":"# next-connect\n\n[![npm](https://badgen.net/npm/v/next-connect)](https://www.npmjs.com/package/next-connect)\n[![CircleCI](https://circleci.com/gh/hoangvvo/next-connect.svg?style=svg)](https://circleci.com/gh/hoangvvo/next-connect)\n[![codecov](https://codecov.io/gh/hoangvvo/next-connect/branch/main/graph/badge.svg?token=LGIyl3Ti4H)](https://codecov.io/gh/hoangvvo/next-connect)\n[![minified size](https://badgen.net/bundlephobia/min/next-connect)](https://bundlephobia.com/result?p=next-connect)\n[![download/year](https://badgen.net/npm/dy/next-connect)](https://www.npmjs.com/package/next-connect)\n\nThe promise-based method routing and middleware layer for [Next.js](https://nextjs.org/) [API Routes](#nextjs-api-routes), [Edge API Routes](#nextjs-edge-api-routes), [Middleware](#nextjs-middleware), [Next.js App Router](#nextjs-app-router), and [getServerSideProps](#nextjs-getserversideprops).\n\n## Features\n\n- Async middleware\n- [Lightweight](https://bundlephobia.com/scan-results?packages=express,next-connect,koa,micro) => Suitable for serverless environment\n- [way faster](https://github.com/hoangvvo/next-connect/tree/main/bench) than Express.js. Compatible with Express.js via [a wrapper](#expressjs-compatibility).\n- Works with async handlers (with error catching)\n- TypeScript support\n\n## Installation\n\n```sh\nnpm install next-connect@next\n```\n\n## Usage\n\nAlso check out the [examples](./examples/) folder.\n\n### Next.js API Routes\n\n`next-connect` can be used in [API Routes](https://nextjs.org/docs/api-routes/introduction).\n\n```typescript\n// pages/api/user/[id].ts\nimport type { NextApiRequest, NextApiResponse } from \"next\";\nimport { createRouter, expressWrapper } from \"next-connect\";\nimport cors from \"cors\";\n\nconst router = createRouter<NextApiRequest, NextApiResponse>();\n\nrouter\n  // Use express middleware in next-connect with expressWrapper function\n  .use(expressWrapper(passport.session()))\n  // A middleware example\n  .use(async (req, res, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .get((req, res) => {\n    const user = getUser(req.query.id);\n    res.json({ user });\n  })\n  .put((req, res) => {\n    if (req.user.id !== req.query.id) {\n      throw new ForbiddenError(\"You can't update other user's profile\");\n    }\n    const user = await updateUser(req.body.user);\n    res.json({ user });\n  });\n\nexport const config = {\n  runtime: \"edge\",\n};\n\nexport default router.handler({\n  onError: (err, req, res) => {\n    console.error(err.stack);\n    res.status(err.statusCode || 500).end(err.message);\n  },\n});\n```\n\n### Next.js Edge API Routes\n\n`next-connect` can be used in [Edge API Routes](https://nextjs.org/docs/api-routes/edge-api-routes)\n\n```typescript\n// pages/api/user/[id].ts\nimport type { NextFetchEvent, NextRequest } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\nimport cors from \"cors\";\n\nconst router = createEdgeRouter<NextRequest, NextFetchEvent>();\n\nrouter\n  // A middleware example\n  .use(async (req, event, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .get((req) => {\n    const id = req.nextUrl.searchParams.get(\"id\");\n    const user = getUser(id);\n    return NextResponse.json({ user });\n  })\n  .put((req) => {\n    const id = req.nextUrl.searchParams.get(\"id\");\n    if (req.user.id !== id) {\n      throw new ForbiddenError(\"You can't update other user's profile\");\n    }\n    const user = await updateUser(req.body.user);\n    return NextResponse.json({ user });\n  });\n\nexport default router.handler({\n  onError: (err, req, event) => {\n    console.error(err.stack);\n    return new NextResponse(\"Something broke!\", {\n      status: err.statusCode || 500,\n    });\n  },\n});\n```\n\n### Next.js App Router\n\n`next-connect` can be used in [Next.js 13 Route Handler](https://beta.nextjs.org/docs/routing/route-handlers). The way handlers are written is almost the same to [Next.js Edge API Routes](#nextjs-edge-api-routes) by using `createEdgeRouter`.\n\n```typescript\n// app/api/user/[id].ts\n\nimport type { NextFetchEvent, NextRequest } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\nimport cors from \"cors\";\n\ninterface RequestContext {\n  params: {\n    id: string;\n  };\n}\n\nconst router = createEdgeRouter<NextRequest, RequestContext>();\n\nrouter\n  // A middleware example\n  .use(async (req, event, next) => {\n    const start = Date.now();\n    await next(); // call next in chain\n    const end = Date.now();\n    console.log(`Request took ${end - start}ms`);\n  })\n  .get((req) => {\n    const id = req.params.id;\n    const user = getUser(id);\n    return NextResponse.json({ user });\n  })\n  .put((req) => {\n    const id = req.params.id;\n    if (req.user.id !== id) {\n      throw new ForbiddenError(\"You can't update other user's profile\");\n    }\n    const user = await updateUser(req.body.user);\n    return NextResponse.json({ user });\n  });\n\nexport async function GET(request: NextRequest, ctx: RequestContext) {\n  return router.run(request, ctx);\n}\n\nexport async function PUT(request: NextRequest, ctx: RequestContext) {\n  return router.run(request, ctx);\n}\n```\n\n### Next.js Middleware\n\n`next-connect` can be used in [Next.js Middleware](https://nextjs.org/docs/advanced-features/middleware)\n\n```typescript\n// middleware.ts\nimport { NextResponse } from \"next/server\";\nimport type { NextRequest, NextFetchEvent } from \"next/server\";\nimport { createEdgeRouter } from \"next-connect\";\n\nconst router = createEdgeRouter<NextRequest, NextFetchEvent>();\n\nrouter.use(async (request, event, next) => {\n  // logging request example\n  console.log(`${request.method} ${request.url}`);\n  return next();\n});\n\nrouter.get(\"/about\", (request) => {\n  return NextResponse.redirect(new URL(\"/about-2\", request.url));\n});\n\nrouter.use(\"/dashboard\", (request) => {\n  if (!isAuthenticated(request)) {\n    return NextResponse.redirect(new URL(\"/login\", request.url));\n  }\n  return NextResponse.next();\n});\n\nrouter.all(() => {\n  // default if none of the above matches\n  return NextResponse.next();\n});\n\nexport function middleware(request: NextRequest, event: NextFetchEvent) {\n  return router.run(request, event);\n}\n\nexport const config = {\n  matcher: [\n    /*\n     * Match all request paths except for the ones starting with:\n     * - api (API routes)\n     * - _next/static (static files)\n     * - _next/image (image optimization files)\n     * - favicon.ico (favicon file)\n     */\n    \"/((?!api|_next/static|_next/image|favicon.ico).*)\",\n  ],\n};\n```\n\n### Next.js getServerSideProps\n\n`next-connect` can be used in [getServerSideProps](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props).\n\n```jsx\n// pages/users/[id].js\nimport { createRouter } from \"next-connect\";\n\nexport default function Page({ user, updated }) {\n  return (\n    <div>\n      {updated && <p>User has been updated</p>}\n      <div>{JSON.stringify(user)}</div>\n      <form method=\"POST\">{/* User update form */}</form>\n    </div>\n  );\n}\n\nconst router = createRouter()\n  .use(async (req, res, next) => {\n    // this serve as the error handling middleware\n    try {\n      return await next();\n    } catch (e) {\n      return {\n        props: { error: e.message },\n      };\n    }\n  })\n  .get(async (req, res) => {\n    const user = await getUser(req.params.id);\n    if (!user) {\n      // https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#notfound\n      return { props: { notFound: true } };\n    }\n    return { props: { user } };\n  })\n  .put(async (req, res) => {\n    const user = await updateUser(req);\n    return { props: { user, updated: true } };\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  return router.run(req, res);\n}\n```\n\n## API\n\nThe following APIs are rewritten in term of `NodeRouter` (`createRouter`), but they apply to `EdgeRouter` (`createEdgeRouter`) as well.\n\n### router = createRouter()\n\nCreate an instance Node.js router.\n\n### router.use(base, ...fn)\n\n`base` (optional) - match all routes to the right of `base` or match all if omitted. (Note: If used in Next.js, this is often omitted)\n\n`fn`(s) can either be:\n\n- functions of `(req, res[, next])`\n- **or** a router instance\n\n```javascript\n// Mount a middleware function\nrouter1.use(async (req, res, next) => {\n  req.hello = \"world\";\n  await next(); // call to proceed to the next in chain\n  console.log(\"request is done\"); // call after all downstream handler has run\n});\n\n// Or include a base\nrouter2.use(\"/foo\", fn); // Only run in /foo/**\n\n// mount an instance of router\nconst sub1 = createRouter().use(fn1, fn2);\nconst sub2 = createRouter().use(\"/dashboard\", auth);\nconst sub3 = createRouter()\n  .use(\"/waldo\", subby)\n  .get(getty)\n  .post(\"/baz\", posty)\n  .put(\"/\", putty);\nrouter3\n  // - fn1 and fn2 always run\n  // - auth runs only on /dashboard\n  .use(sub1, sub2)\n  // `subby` runs on ANY /foo/waldo?/*\n  // `getty` runs on GET /foo/*\n  // `posty` runs on POST /foo/baz\n  // `putty` runs on PUT /foo\n  .use(\"/foo\", sub3);\n```\n\n### router.METHOD(pattern, ...fns)\n\n`METHOD` is an HTTP method (`GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `TRACE`) in lowercase.\n\n`pattern` (optional) - match routes based on [supported pattern](https://github.com/lukeed/regexparam#regexparam-) or match any if omitted.\n\n`fn`(s) are functions of `(req, res[, next])`.\n\n```javascript\nrouter.get(\"/api/user\", (req, res, next) => {\n  res.json(req.user);\n});\nrouter.post(\"/api/users\", (req, res, next) => {\n  res.end(\"User created\");\n});\nrouter.put(\"/api/user/:id\", (req, res, next) => {\n  // https://nextjs.org/docs/routing/dynamic-routes\n  res.end(`User ${req.params.id} updated`);\n});\n\n// Next.js already handles routing (including dynamic routes), we often\n// omit `pattern` in `.METHOD`\nrouter.get((req, res, next) => {\n  res.end(\"This matches whatever route\");\n});\n```\n\n> **Note**\n> You should understand Next.js [file-system based routing](https://nextjs.org/docs/routing/introduction). For example, having a `router.put(\"/api/foo\", handler)` inside `page/api/index.js` _does not_ serve that handler at `/api/foo`.\n\n### router.all(pattern, ...fns)\n\nSame as [.METHOD](#methodpattern-fns) but accepts _any_ methods.\n\n### router.handler(options)\n\nCreate a handler to handle incoming requests.\n\n**options.onError**\n\nAccepts a function as a catch-all error handler; executed whenever a handler throws an error.\nBy default, it responds with a generic `500 Internal Server Error` while logging the error to `console`.\n\n```javascript\nfunction onError(err, req, res) {\n  logger.log(err);\n  // OR: console.error(err);\n\n  res.status(500).end(\"Internal server error\");\n}\n\nexport default router.handler({ onError });\n```\n\n**options.onNoMatch**\n\nAccepts a function of `(req, res)` as a handler when no route is matched.\nBy default, it responds with a `404` status and a `Route [Method] [Url] not found` body.\n\n```javascript\nfunction onNoMatch(req, res) {\n  res.status(404).end(\"page is not found... or is it!?\");\n}\n\nexport default router.handler({ onNoMatch });\n```\n\n### router.run(req, res)\n\nRuns `req` and `res` through the middleware chain and returns a **promise**. It resolves with the value returned from handlers.\n\n```js\nrouter\n  .use(async (req, res, next) => {\n    return (await next()) + 1;\n  })\n  .use(async () => {\n    return (await next()) + 2;\n  })\n  .use(async () => {\n    return 3;\n  });\n\nconsole.log(await router.run(req, res));\n// The above will print \"6\"\n```\n\nIf an error in thrown within the chain, `router.run` will reject. You can also add a try-catch in the first middleware to catch the error before it rejects the `.run()` call:\n\n```js\nrouter\n  .use(async (req, res, next) => {\n    return next().catch(errorHandler);\n  })\n  .use(thisMiddlewareMightThrow);\n\nawait router.run(req, res);\n```\n\n## Common errors\n\nThere are some pitfalls in using `next-connect`. Below are things to keep in mind to use it correctly.\n\n1. **Always** `await next()`\n\nIf `next()` is not awaited, errors will not be caught if they are thrown in async handlers, leading to `UnhandledPromiseRejection`.\n\n```javascript\n// OK: we don't use async so no need to await\nrouter\n  .use((req, res, next) => {\n    next();\n  })\n  .use((req, res, next) => {\n    next();\n  })\n  .use(() => {\n    throw new Error(\"💥\");\n  });\n\n// BAD: This will lead to UnhandledPromiseRejection\nrouter\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async (req, res, next) => {\n    next();\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n  });\n\n// GOOD\nrouter\n  .use(async (req, res, next) => {\n    await next(); // next() is awaited, so errors are caught properly\n  })\n  .use((req, res, next) => {\n    return next(); // this works as well since we forward the rejected promise\n  })\n  .use(async () => {\n    throw new Error(\"💥\");\n    // return new Promise.reject(\"💥\");\n  });\n```\n\nAnother issue is that the handler would resolve before all the code in each layer runs.\n\n```javascript\nconst handler = router\n  .use(async (req, res, next) => {\n    next(); // this is not returned or await\n  })\n  .get(async () => {\n    // simulate a long task\n    await new Promise((resolve) => setTimeout(resolve, 1000));\n    res.send(\"ok\");\n    console.log(\"request is completed\");\n  })\n  .handler();\n\nawait handler(req, res);\nconsole.log(\"finally\"); // this will run before the get layer gets to finish\n\n// This will result in:\n// 1) \"finally\"\n// 2) \"request is completed\"\n```\n\n2. **DO NOT** reuse the same instance of `router` like the below pattern:\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.get(x).handler();\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.get(y).handler();\n```\n\nThis is because, in each API Route, the same router instance is mutated, leading to undefined behaviors.\nIf you want to achieve something like that, you can use `router.clone` to return different instances with the same routes populated.\n\n```javascript\n// api-libs/base.js\nexport default createRouter().use(a).use(b);\n\n// api/foo.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(x).handler();\n\n// api/bar.js\nimport router from \"api-libs/base\";\nexport default router.clone().get(y).handler();\n```\n\n3. **DO NOT** use response function like `res.(s)end` or `res.redirect` inside `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst handler = createRouter()\n  .use((req, res) => {\n    // BAD: res.redirect is not a function (not defined in `getServerSideProps`)\n    // See https://github.com/hoangvvo/next-connect/issues/194#issuecomment-1172961741 for a solution\n    res.redirect(\"foo\");\n  })\n  .use((req, res) => {\n    // BAD: `getServerSideProps` gives undefined behavior if we try to send a response\n    res.end(\"bar\");\n  });\n\nexport async function getServerSideProps({ req, res }) {\n  await router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n3. **DO NOT** use `handler()` directly in `getServerSideProps`.\n\n```javascript\n// page/index.js\nconst router = createRouter().use(foo).use(bar);\nconst handler = router.handler();\n\nexport async function getServerSideProps({ req, res }) {\n  await handler(req, res); // BAD: You should call router.run(req, res);\n  return {\n    props: {},\n  };\n}\n```\n\n## Contributing\n\nPlease see my [contributing.md](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","homepage":"https://github.com/hoangvvo/next-connect#readme","bugs":{"url":"https://github.com/hoangvvo/next-connect/issues"}}