diff --git a/app.js b/app.js index b96a54c..4f79ee0 100644 --- a/app.js +++ b/app.js @@ -25,8 +25,10 @@ var config = require('./config/database'); //mongoose.Promise = require('bluebird'); mongoose.connect(config.database); app.use(function(req, res, next) { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); + res.setHeader('Access-Control-Allow-Origin', '*'); + res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); + res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); + res.setHeader('Access-Control-Allow-Credentials', true); next(); }); app.use(session({ diff --git a/bin/www b/bin/www index 3b45ba2..df9b652 100644 --- a/bin/www +++ b/bin/www @@ -34,8 +34,8 @@ var credentials = { cert: certificate, passphrase: 'titi' }; -var server = https.createServer(credentials, app); - +//var server = https.createServer(credentials, app); +var server = http.createServer(app); // server.setSecure(credentials); /** diff --git a/routes/api.js b/routes/api.js index 1bb0a36..83a76af 100644 --- a/routes/api.js +++ b/routes/api.js @@ -48,7 +48,13 @@ const storage = multer.diskStorage({ } }); - +router.use(function(req, res, next) { + res.setHeader('Access-Control-Allow-Origin', '*'); + res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); + res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); + res.setHeader('Access-Control-Allow-Credentials', true); + next(); +}); /* GET home page. */ router.get('/', function(req, res, next) { res.send('Express RESTful API'); diff --git a/src/app/book/book.component.html b/src/app/book/book.component.html index 4744e9d..1b0b977 100644 --- a/src/app/book/book.component.html +++ b/src/app/book/book.component.html @@ -12,6 +12,10 @@ + + + +
@@ -32,7 +36,7 @@
- + \ No newline at end of file diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 962c214..f79d7f4 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -75,9 +75,7 @@ export class MainComponent implements OnInit { if(this.allUserAppFolder !== undefined) { tempp = this.allUserAppFolder; test = tempp.filter((folder) => folder.origin === name); - if(test[0] !== undefined){ - console.log(test[0].origin); - } + } return test; } @@ -88,7 +86,7 @@ export class MainComponent implements OnInit { if (files) { this.allUserAppFile = files; for (let f of this.allUserAppFile){ - console.log(f.name); + //console.log(f.name); //f.fileTab = this.getfiles(f); } // return files; @@ -106,7 +104,7 @@ export class MainComponent implements OnInit { this.allUserAppFolder = folders; for (let f of this.allUserAppFolder){ f.origin = this.setOriginFolder(f.path); - console.log('origin : ' + f.origin); + //console.log('origin : ' + f.origin); } this.getAllUserAppFiles();