* Sets up headers common to all Solid requests (CORS-related, Allow, etc). * * @param app {Function} Express.js app instance
(app)
| 200 | * @param app {Function} Express.js app instance |
| 201 | */ |
| 202 | function 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. |
no test coverage detected