---
title: "Discussion on \"Testing for API in NextJS\" | Hashnode"
description: "Discussion on \"Testing for API in NextJS\". import { createMocks, RequestMethod } from 'node-mocks-http';\nimport type { NextApiRequest, NextApiResponse } from 'next';\n\n\nimport apiGetEnv from '../pages/api/get-env';\n\n\ndescribe(\"test api\", () => {\n function mockRequestResponse(method: RequestMet..."
url: "https://hashnode.com/posts/testing-for-api-in-nextjs/65e7ee6e3d481157d0f5f71c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Testing for API in NextJS](https://tech.finlup.id/testing-for-api-in-nextjs?utm_source=hashnode&utm_medium=feed)

import { createMocks, RequestMethod } from 'node-mocks-http'; import type { NextApiRequest, NextApiResponse } from 'next'; import apiGetEnv from '../pages/api/get-env'; describe("test api", () => { function mockRequestResponse(method: RequestMet...

Mar 6, 2024 · 1 min read · tech.finlup.id  
Read the article

-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#jest](https://hashnode.com/tag/jest)

## Written by

[Ariska Hidayat](https://hashnode.com/@ariska138)

@ariska138 · Sragen, Indonesia

  
[View profile](https://hashnode.com/@ariska138)

We Make Technology Easy and Fun

I am an enthusiastic researcher and developer with a passion for using technology to innovate in business and education.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
