Hi guys, I've created a route but cannot access it in development environment, getting error 422 "GGT_UNDEPLOYED_ENVIRONMENT: This Gadget application has not been deployed to Production." First I tried in Postman, then in API Playground as the AI tool told me to do. So the AI Tool tells me to do an unsupported thing. Do I really have to deploy to production to test anything??
I use this code in playground advised by the AI:
try {
const response = await fetch('/data', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
test: 'data',
message: 'Hello from API Playground'
})
});
console.log('Response status:', response.status);
console.log('Response headers:', response.headers);
if (response.ok) {
const data = await response.json();
console.log('Response data:', data);
} else {
const errorText = await response.text();
console.log('Error response:', errorText);
}
} catch (error) {
console.error('Fetch error:', error);
}
And here's my route file:
api/routes/POST-data.js (attached)