MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / checkAccountExists

Function checkAccountExists

lib/api/accounts/user-accounts.mjs:23–38  ·  view source on GitHub ↗
(accountManager)

Source from the content-addressed store, hash-verified

21 * @return {Function}
22 */
23export function checkAccountExists (accountManager) {
24 return (req, res, next) => {
25 const accountUri = req.hostname
26
27 accountManager.accountUriExists(accountUri)
28 .then(found => {
29 if (!found) {
30 debugAccounts(`Account ${accountUri} is available (for ${req.originalUrl})`)
31 return res.sendStatus(404)
32 }
33 debugAccounts(`Account ${accountUri} is not available (for ${req.originalUrl})`)
34 next()
35 })
36 .catch(next)
37 }
38}
39
40/**
41 * Returns an Express middleware handler for adding a new certificate to an

Callers 1

middlewareFunction · 0.85

Calls 1

accountUriExistsMethod · 0.80

Tested by

no test coverage detected