Skip to content
Advertisement

Tag: node.js

rest / spread in java script

guys can someone explain what ([head, …[headTail, …tailTail]]) in the input of this link solution is doing? I can’t comment and ask the writer due to low reputation! he is writing a function that takes an array of arrays in input (based on where he calls it) but although I know few things about rest and spread in Java Script

How can I make a simple chat/store messages in localhost?

I’m working on exercise, a simple chat/store messages, working on localhost, but it’s not working properly. The objective is to send user and message, and store the user and messages sent with a date. Like:(11:32 @USER: Hello world). This message data (with user,message and date) should be displayed on page, one after another. I’m doing this with no dependencies, but

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.sockets.adapter.rooms, I get the following: However, when I try to log io.sockets.adapter.rooms[socket.roomId], it returns

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

Advertisement