Endpoints
Svr-api structure​
The svr-api index.js fires up express fairly normal, along with sentry and datadog (dd-trace). express/index.js does a few things, most importantly sets the session config, starts agenda (jobs), and binds the request to rqPass, rqFail by lib/resHandler/index.js middleware.
express/routes.js has a lot of stuff that is legacy, maybe some is still used. I look at datadog from time to time to see what endpoints are still used that aren’t v2 - comments are in this file. At the bottom of routes.js is the use of v2.route.js which is all the new stuff since 2020.
The /lib folder is almost all legacy, everything except v2. However some legacy is still used, for example the director dash still uses legacy company endpoints, we’ve never been given time to migrate everything to v2, along with figuring out what/where is still calling legacy endpoints.
/lib/v2 .. most everything here is in use, but not all. Each folder has a handler with routes, a controller with route logic, and an etc folder containing smaller functions. I was never a fan of using models everywhere to make database calls, so we have wrapper functions like v2/user/etc/findUser for example. I also believe all logic should be at the controller level and not on the models (thin-model pattern); however still to this day we have some logic on models that causes trouble from time to time. Models live in their own svr-models package.
Client-config is an endpoint we use to return generic constant vals like background image urls .. what's still in use in here idk. We currently don’t use sockets, but the socketHandler is there, along with videoSteams and rtmp if that functionality ever comes back.