Skip to content

Tag: javascript

Sort the array of database object-id

I have a array of mongodb object-id and i want to sort them in such a way that similar IDs are next to each other example : Input : var array = [“507f191e810c19729de860ea”,”00000020f51bb4362eee2a4d”,” 507f191e810c19729de860ea”] Output : var array = [“507f191e810c19729de860ea&#822…

middleware.js in nextjs doesn’t work at all

(Next v.12.2.3) No matter what I code, pages/middleware.js seems not running at all! I wanna redirect uppercase urls to lowercase urls. what should I do? Answer The documentation says: Create a middleware.ts (or .js) file at the same level as your pages directory So it shouldn’t be inside pages/, but in…

Capture value from an input with svelte

I’m trying to capture the value of an input using the svelte framework When initializing the local environment I already get the following error in the console: Uncaught TypeError: Cannot read properties of null (reading ‘value’) Visual Studio Code marks the code snippet .value when I try to…

Encrypting data using query in Node.js and MySql

Is it safe to encrypt the data posted in MySql using query in node.js? I tried something like this and it works pretty fine in terms of encryption but I don’t know exactly how safe it is, I am pretty much a begginer in this area. Answer Let’s say I wanna encrypt the password so it could be safe fr…