{"id":13456304,"url":"https://github.com/mtbrault/nextjs-http-supertest","last_synced_at":"2025-03-24T09:31:58.581Z","repository":{"id":65322948,"uuid":"589597799","full_name":"mtbrault/nextjs-http-supertest","owner":"mtbrault","description":"npm package to get an http server parsing your nextJS app to link endpoint with handler","archived":false,"fork":false,"pushed_at":"2024-10-15T08:44:09.000Z","size":25,"stargazers_count":14,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T05:57:03.377Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtbrault.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-16T13:52:25.000Z","updated_at":"2025-02-27T13:05:38.000Z","dependencies_parsed_at":"2024-06-20T00:02:37.996Z","dependency_job_id":"7a98723b-7060-42c2-a838-f3d0838d71a6","html_url":"https://github.com/mtbrault/nextjs-http-supertest","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtbrault%2Fnextjs-http-supertest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtbrault%2Fnextjs-http-supertest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtbrault%2Fnextjs-http-supertest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtbrault%2Fnextjs-http-supertest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtbrault","download_url":"https://codeload.github.com/mtbrault/nextjs-http-supertest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245243394,"owners_count":20583616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:01:19.562Z","updated_at":"2025-03-24T09:31:58.271Z","avatar_url":"https://github.com/mtbrault.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# nextjs-http-supertest\n\nThis package do several things:\n* Parse the file under your `pages/api` nextJS folder\n* Link your handler with the HTTP endpoint\n* When performing a request with `supertest`, parsing the URL and the query parameters to call the correct handler.\n\nRequirement: Your api handlers must be located under `pages/api` or `src/pages/api` at the root of your nextJS repository.\n\nIt returns an http server instance (do not forget to close it after running your test suite).\n\nExample below in a `toto.test.js` jest file.\n\n```javascript\nimport request from 'supertest';\nimport server from 'nextjs-http-supertest';\n\ndescribe('my super test suite', () =\u003e {\n\n    afterAll(() =\u003e {\n        server.close(); // don't forget to close your server after your tests\n    })\n\n    it('200: Should return a toto array', async () =\u003e {\n        const r = await request(server).get('/api/toto').query({ offset: 0, limit: 10 });\n        expect(r.statusCode).toEqual(200);\n        expect(r.body.length).toEqual(10);\n    })\n})\n```\n\nIt handles typescript\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtbrault%2Fnextjs-http-supertest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtbrault%2Fnextjs-http-supertest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtbrault%2Fnextjs-http-supertest/lists"}