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

Function initHeaders

lib/create-app.mjs:202–218  ·  view source on GitHub ↗

* Sets up headers common to all Solid requests (CORS-related, Allow, etc). * * @param app {Function} Express.js app instance

(app)

Source from the content-addressed store, hash-verified

200 * @param app {Function} Express.js app instance
201 */
202function initHeaders (app) {
203 app.use(corsSettings)
204
205 app.use((req, res, next) => {
206 res.set('X-Powered-By', 'solid-server/' + version)
207
208 // Cors lib adds Vary: Origin automatically, but inreliably
209 res.set('Vary', 'Accept, Authorization, Origin')
210
211 // Set default Allow methods
212 res.set('Allow', 'OPTIONS, HEAD, GET, PATCH, POST, PUT, DELETE')
213 next()
214 })
215
216 app.use('/', capabilityDiscovery())
217 app.use('/', paymentPointerDiscovery())
218}
219
220/**
221 * Sets up the express rendering engine and views directory.

Callers 1

createAppFunction · 0.85

Calls 2

capabilityDiscoveryFunction · 0.85
paymentPointerDiscoveryFunction · 0.85

Tested by

no test coverage detected