You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
697 B
JavaScript
29 lines
697 B
JavaScript
import axios from 'axios'
|
|
import { useRouter } from "next/router"
|
|
|
|
export const config = {
|
|
api: {
|
|
externalResolver: true,
|
|
},
|
|
}
|
|
|
|
export default async function handler(req, res) {
|
|
const randCoords = "https://orthoverse.io/api/land/visit?name=random"
|
|
const jsonByCoords = "https://orthoverse.io/api/land/search/byCoordinates?"
|
|
|
|
try {
|
|
axios.get(randCoords).then((loc) => {
|
|
axios.get(jsonByCoords + "x=" + loc.data.x + "&y=" + loc.data.y).then((result) => {
|
|
res.statusCode = 200
|
|
res.json(result.data)
|
|
res.end()
|
|
})
|
|
})
|
|
} catch (err) {
|
|
// console.log(err)
|
|
res.status(404)
|
|
res.json({ error: "Something went wrong" })
|
|
res.end()
|
|
}
|
|
}
|