Commit 7174d327 authored by Mikey's avatar Mikey

enable cors on server

parent 644c3442
......@@ -23,6 +23,7 @@
"homepage": "https://github.com/valueflows/valueflo.ws#readme",
"dependencies": {
"finalhandler": "^0.4.0",
"http-cors": "^1.0.1",
"serve-static": "^1.10.0"
},
"devDependencies": {
......
var finalhandler = require('finalhandler')
var http = require('http')
var serveStatic = require('serve-static')
var Cors = require('http-cors')
var cors = new Cors()
var serve = serveStatic(__dirname)
var server = http.createServer(function(req, res){
var done = finalhandler(req, res)
if (cors.apply(req, res))
return; // this was an OPTIONS request - no further action needed
serve(req, res, done)
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment