initial commit

This commit is contained in:
madarsbiss
2021-07-16 23:05:27 +03:00
parent de2fba45a3
commit 4593c3cabd
41 changed files with 105 additions and 192 deletions

8
pages/api/data.js Normal file
View File

@@ -0,0 +1,8 @@
export default async function handler(req, res) {
const { input } = req.body;
const getWeatherData = await fetch(
`https://api.openweathermap.org/data/2.5/weather?q=${input}&units=metric&appid=${process.env.OPENWEATHER_API_KEY}`
);
const data = await getWeatherData.json();
res.status(200).json(data);
}

View File

@@ -1,5 +0,0 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default function handler(req, res) {
res.status(200).json({ name: 'John Doe' })
}