Answer the question
In order to leave comments, you need to log in
How to properly save an avatar?
I am writing a chat application on KOA, Socket.IO, Mongoose, I need to implement the functionality of saving avatars for users. The system is arranged as follows: there is a login page that works on passport-local, if the user is logged in, I create a JWT, which is stored in LocalStorage, for authorization in the chat using socketIO-JWT. implemented the functionality of loading images using multer, organized the user model in monguz. And now my form sends a file to the address '/ava', the handler of which should save the file name to the user model, but I don't understand how to implement this without using sessions?
Answer the question
In order to leave comments, you need to log in
Use jwt to authenticate the user, write a middleware to validate it and get the user model.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question