I have build a simple web server using Express js. There I have one GET request to send any json response. Now this request can be accessed from anywhere by anyone.
How can I restrict this GET request from having public access and what approach should I follow to restrict this public access?
Please note, I don't have the login or logout feature, only simple GET request.
Below is my code ---
const express = require('express');
const app = express();
app.get('/', (req, res) => { res.send('Test response'); });
app.listen(3000, () => console.log('Listening on port 3000!'));