I'm working on a web application. Everything was developed locally, and everything works perfectly. I made the app available on digitalocean. Everything works properly when I access the site from a desktop computer, but express get requests do not work on mobile devices.
This is the app.js code.
const express = require('express');
const app = express();
const fetch = require('node-fetch');
app.listen(3000, () => console.log("Listening at 3000"));
app.use(express.static('public'));
app.use(express.json({limit: '1mb'}));
const hogan = require('hogan.js');
const fs = require('fs');
//GOOGLE PLACES AUTO COMPLETE
app.get('/placesAC/:input', async (request, response) => {
const userInput = request.params['input'];
const placesAPI = 'https://maps.googleapis.com/maps/api/place/autocomplete/json?';
const placeConditions = '®ion=tr';
const APIKey = '&key=MY_API_KEY';
const input = 'input=' + userInput;
const finalURL = placesAPI + input + placeConditions + APIKey;
const fetch_response = await fetch(finalURL);
const json = await fetch_response.json();
response.json(json);
console.log(userInput);
});
I'm getting it from the client in this manner.
const inputVal = fromText.value;
const apiURL = '/placesAC/' + inputVal;
const response = await fetch(apiURL);
const json = await response.json();