Skip to content

Instantly share code, notes, and snippets.

@vrajdesai78
Created June 20, 2023 13:08
Show Gist options
  • Save vrajdesai78/f08dddbea39f03f0d298e7678a8f998f to your computer and use it in GitHub Desktop.
Save vrajdesai78/f08dddbea39f03f0d298e7678a8f998f to your computer and use it in GitHub Desktop.
import axios from 'axios';
import type { NextApiRequest, NextApiResponse } from 'next';
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
const { data } = await axios.post(
'https://api.huddle01.com/api/v1/create-room',
{
title: 'Huddle01-Test',
roomLock: false,
},
{
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.API_KEY,
},
}
);
res.status(200).json(data);
} catch (error) {
res.status(500).json(error);
}
};
export default handler;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment