Use normal post and get functions
-
Hello. There are certain cases where I can't find the right hooks to do what I want. So, sometimes i use custom POST and GET express functions (in my plugin script), without any hook, and invoke them directly from the client with jquery.
Is it a bad practice? Im a newbie to nodebb so I don't know. Is user authentication also valid in custom functions? -
Have you tried using websockets?
NodeBB core and many plugins utilize websockets for communication between front-end and back-end and I think they will be easier for bi-directional communication than utilizing raw post/get.
Look here for instructions (I think you can use async/await instead of callbacks if you want. I'm certain you will be able to in 1.13.0, as NodeBB is currently in the process of being refactored to use async functions, but it might work even now ).