I want to make MSA so i want to use front server and backend server both.
So frontend calls api/route structure file api. and File api calls backend api with axios.
the problem is return new Response(callAxios())
code keeps telling me red line error mark probably can not confirm type like JSON or String.
No problem with using cuz still i can get JSON data but how can i remove the red line error mark
I am not familiar with typescript and just started today.
import axios from "axios"
export async function GET(request: Request) {
return new Response(callAxios())
}
async function callAxios(){
await axios.get('http://localhost:8080/firstCall', {
params: { // query string
title: 'NEXT JS'
},
headers: {
'X-Api-Key': 'my-api-key'
},
}).then(res => {
console.log(res.data)
return res.data
})
}
Remove the error mark and make sure accepting data type is correct.