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

Function serviceCapabilityDocument

lib/capability-discovery.mjs:28–51  ·  view source on GitHub ↗

* Serves the service capability document (containing server root URL, including * any base path the user specified in config, server API endpoints, etc). * @method serviceCapabilityDocument * @param req * @param res * @param next

()

Source from the content-addressed store, hash-verified

26 * @param next
27 */
28function serviceCapabilityDocument () {
29 return (req, res) => {
30 const ldp = req.app.locals.ldp
31 res.json({
32 // Add the server root url
33 root: ldp.resourceMapper.resolveUrl(req.hostname, req.path),
34 // Add the 'apps' urls section
35 apps: req.app.locals.appUrls,
36 api: {
37 accounts: {
38 // 'changePassword': '/api/account/changePassword',
39 // 'delete': '/api/accounts/delete',
40
41 // Create new user (see IdentityProvider.post() in identity-provider.js)
42 new: new URL('/api/accounts/new', ldp.serverUri),
43 recover: new URL('/api/accounts/recover', ldp.serverUri),
44 signin: ldp.resourceMapper.resolveUrl(req.hostname, '/login'),
45 signout: ldp.resourceMapper.resolveUrl(req.hostname, '/logout'),
46 validateToken: new URL('/api/accounts/validateToken', ldp.serverUri)
47 }
48 }
49 })
50 }
51}

Callers 1

capabilityDiscoveryFunction · 0.85

Calls 1

resolveUrlMethod · 0.80

Tested by

no test coverage detected