Move CORS to apply to all routes
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Garrett Mills 2020-12-24 14:46:11 -06:00
parent f935507612
commit 157283a1cc
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246
3 changed files with 16 additions and 1 deletions

View File

@ -31,6 +31,7 @@ const FlitterUnits = {
* Custom units that modify or add functionality that needs to be made * Custom units that modify or add functionality that needs to be made
* available to the middleware-routing-controller stack. * available to the middleware-routing-controller stack.
*/ */
'CORS' : require('./app/CORSUnit'),
'Upload' : require('flitter-upload/UploadUnit'), 'Upload' : require('flitter-upload/UploadUnit'),
/* /*

14
app/CORSUnit.js Normal file
View File

@ -0,0 +1,14 @@
const Unit = require('libflitter/Unit')
const cors = require('cors')
class CORSUnit extends Unit {
static get name() {
return 'cors'
}
async go(app) {
app.express.use(cors())
}
}
module.exports = exports = CORSUnit

View File

@ -19,7 +19,7 @@ class IonicUnit extends Unit {
} }
async go(app) { async go(app) {
app.express.use(cors()) // app.express.use(cors())
app.express.use('/i', [ app.express.use('/i', [
this.canon.get('middleware::auth:UserOnly'), this.canon.get('middleware::auth:UserOnly'),