importing the request in expressjs

I’m creating a helper method in my code which I can use for authorizing users, I am creating a function called "usePermissions" following the react way but on the back-end. The usePermissions() will return true or false based on some x, y and z. But this method depends on the request object, so in order… Read More importing the request in expressjs

HTML Multiple select not returning array

I’m trying to make a web application using express and I’m trying to make a form to create a new product. In there I have multiple select to select the categories for the product. Here is my code for the multi-select: <div class="form-group row mb-3"> <label for="categories" class="col-form-label sol-sm-2">Categories:</label> <div class="col-sm-10"> <select multiple name="product[categories[]]" id="categories"… Read More HTML Multiple select not returning array

Is there a way to detect screen size in node.js?

Specifically, I would like to make a GET request to a nodejs server, then get the number of monitors and their resolutions for the server. E.g. app.get(‘/screens’, (req, res) => { //return the screen info for the computer running this express server }) >Solution : With systeminformation package. … const si = require(‘systeminformation’) app.get(‘/screens’, async(req,… Read More Is there a way to detect screen size in node.js?

How to get data from app.post in react.js?

//server.js app.post(‘/trip’, function(req,res){ var params = "something"; getResult(params).then((db)=>{ // I want to access variable named "db" in App.js(React), but I don’t know how to do. res.send(db); res.end(); }); }); I want to access variable named "db" in App.js(React), but I don’t know how to do. If I use axios like //App.js axios.get(‘http://localhost:3000/trip&#8217;).then((response)=>{ console.log(response.data); }) but… Read More How to get data from app.post in react.js?

repost: Setting up express.js Server

Im encountering this error on replit while setting up my express server, im still starting to learn express so i still dont know some of it means /home/runner/log-in-API/node_modules/express/lib/router/index.js:513 this.stack.push(layer); ^ TypeError: Cannot read properties of undefined (reading ‘push’) at Function.route (/home/runner/log-in-API/node_modules/express/lib/router/index.js:513:14) at file:///home/runner/log-in-API/api/reviews.route.js:4:8 at ModuleJob.run (node:internal/modules/esm/module_job:198:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:385:24)… Read More repost: Setting up express.js Server