EndpointManager
class
EndpointManager
Private Class
Methods / Properties
register=> Function
<>
BP.Plug:
Moopsy Blueprint Plug
()
BP:
Moopsy Blueprint Constants
handler:
MoopsyEndpointHandler (Function)
MoopsyEndpointHandler
async
(params, auth)
=>
Async Function
()
params:
ParamsType of BP.Plug
auth:
{}
public:
PublicAuthType of AuthSpec
private:
PrivateAuthType from MoopsyServer
=>
Promise<ReturnType of BP.Plug>
EndpointManager is a Private Class used to handle endpoints. You should never create it directly, use it as a property of a MoopsyServer
.
Usage
const server = new MoopsyServer({}, { handleAuthLogin });
server.endpoints.register<FooBP.Plug>(FooBP.Plug, async (params, auth) => {
if(auth.private.userType !== "admin") {
throw new MoopsyError(403, '403', 'Access Denied);
}
// Your method code
});