Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

nextjs api example typescript

import type { NextApiRequest, NextApiResponse } from "next";

type Data = {
  name: string;
};

const handler = (req: NextApiRequest, res: NextApiResponse<Data>) => {
  res.status(200).json({ name: "John Doe" });
};

export default handler;
Comment

next api typescript

import type { NextApiRequest, NextApiResponse } from 'next'

type Data = {
  name: string
}

export default (req: NextApiRequest, res: NextApiResponse<Data>) => {
  res.status(200).json({ name: 'John Doe' })
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: trigger change select element jquery 
Javascript :: syntax jquery 
Javascript :: javascript array includes another array 
Javascript :: install moment in goole dev console 
Javascript :: how to make a property important in javascript 
Javascript :: kill node 
Javascript :: jquery check scroll direction 
Javascript :: useeffect with axios react 
Javascript :: javascript add attribute 
Javascript :: how to change background image using javascript 
Javascript :: moment remove one day 
Javascript :: unique objects in array javascript 
Javascript :: jquery if class exists 
Javascript :: jquery style display 
Javascript :: js number 2 decimal places 
Javascript :: styling scrollview height in react native 
Javascript :: jquery set attribute stack overflow 
Javascript :: nodejs does every worker thread need a new core 
Javascript :: js update query string 
Javascript :: each input form jquery 
Javascript :: check window resize javascript 
Javascript :: sequelize exclude attribute 
Javascript :: node js fetch 
Javascript :: js find lowest number in array 
Javascript :: json server sorting 
Javascript :: wp_enqueue_script bootstrap 
Javascript :: jquery clear select 2 
Javascript :: jquery ajax get 
Javascript :: jquery ajax post form 
Javascript :: javascript count occurrences of letter in string 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =