I am trying to prevent users from login in twice and creating 2 sessions (when they press log in button twice very fast). I am thinking of disabling button after it was click and the enabling it after approx. 2 sec in case there was an error e.g. “password incorrect” so that users can reenter thei…
Tag: node.js
How can i upload file using formidable with nextjs on vercel
api/upload.js api/get.js Everything is working fine at localhost but it’s not working when i deploy it on vercel. Function log from vercel dashboard Answer if it works on localhost, it’s because the application mode on localhost is dev, and if in vercel the application mode is production so it onl…
Encountering a problem when trying to insert JSON data into my postgres database – Node.js
I’m having a problem when i try to save my JSON data into a database. Right now, i have this code here: My service that retrieves and cache data from an API with the given parameter cep: My route using the service: It works with out problems: Here that comes the problem. When i try to insert the data in…
How to find a document with an array of strings based on if it has items in common with a reference array of string?
Given a reference array of strings: [“Comedy”, “Horror”, “Romance”], I would like to query a Movie model with this schema: Such that I will get results where I will get Movies with categories in common with the reference array, sorted by the amount of elements it has in com…
How to make discord bot wait for reply for 5 minutes and then send a message? Using discord js
I am using Discord js to make a discord bot. The role of the bot is to send a message to user in personal messages and then wait for user response for 5 minutes. If user does not sends anything back to the member then a message is send by the bot that there request has been denied because they
Json schema validation against Json Object using javascript
I am trying to validate around 100 JSON Objects against a JSON schema to see if all the fields along with the type are as per the schema or not. Tried below JSON schema which was generated from a site. The issue with the below schema is that it does not support validation of multiple items for the “file…
QuerySnapshot.empty causes a promise rejection error
I have a back-end using firebase-admin and express to allow post requests from the client to the server to make changes to the firestore I have that contains stuff like user data (this is a test and not a real product). I want to check if a document already exists so a user cannot register with that username …
Finding client’s public IP in Nodejs deployed on AWS EC2
Background to the issue: My background is non-networked programming so I am new to web development. I’m in the process of teaching myself javascript. I am experimenting with node.js and have deployed it on a free AWS EC2 instance to play around with it. I wish to work with an IP geolocation API and ther…
Axios adds extra trailing slash in body values
I am developing an application with React Native, which communicates with an IoT chip (with very little ram memory), because of that all the logic must be developed on the client side. One of the specifications of this chip is all the characters “,” must to be escaped with just one trilling slash.…
Delete property from object in argument vs Delete property from object
Just trying to figure out some questions. context: randomFunction is a function that takes 2 arguments(id & metaData). It is a called inside a controller . The code is given below: doc contains a object (basically a document in mongodb). suppose doc contains the following: Now , in the operations file whe…