Skip to content

Tag: express

Express Sharp install via Docker issue

I need to use sharp. Its work fine on my workspace but if I deploymeny via docker then I get error. I am implementation all steps. I think sharp is prebuilt when first install. It uses the architecture of my computer(darwin, arm) But when it runs on the docker, although it gets built again, the work talks abo…

API return values based on certain criteria

I am working on an API, and I want to return values based on some input I receive. For example, here is a body sample input Based on the fields array, I want my API to return only those values. Here is an example of the API implementation So the part where I indicate stuck here I want to loop

How to remove falsy values from array of objects

I have an array of objects like so, I want to remove the last object from the array since it has falsy values, I tried to achieve this by writing a simple function like so That didn’t fix the issue, I also tried to use but that just returned the keys in the object, how can I achieve this, please?

Setting Socket.io room variables

I would like to store some information in the socket room variables, but am getting the following error: UnhandledPromiseRejectionWarning: TypeError: Cannot set property ‘host’ of undefined This is my code: If I try to log socket.roomId it would return something like rBAhx0. And when I log io.sock…

How to exclude fields on return in mongoose

I have the following code: It works perfectly but say I want to exclude a field returned, like the __v field. I know I can do this by just creating an object like and etc. for teh other fields, however if I have 20 fields I don’t want to list every single one, so is there a way for mongoose