Move CORS to apply to all routes
This commit is contained in:
parent
f935507612
commit
157283a1cc
@ -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
14
app/CORSUnit.js
Normal 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
|
@ -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'),
|
||||||
|
Loading…
Reference in New Issue
Block a user