박기홍

cors added

const express = require('express');
const app = express();
// const cors = require('cors');
const cors = require('cors');
const port = 8000;
const mongoose = require('mongoose');
......@@ -9,6 +9,14 @@ const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
// app.all('/*', function(req, res, next){
// res.header("Access-Control-Allow-Origin", "*");
// res.header("Access-Control-Allow-Headers", "X-Requested-With");
// next();
// })
app.use(cors());
const db = mongoose.connection;
db.on('error', console.error);
db.once('open', function(){
......