Created
August 8, 2013 16:41
-
-
Save jrowny/6186325 to your computer and use it in GitHub Desktop.
A quick "serve this folder" express web server that has CORS way open. TEST ONLY don't you dare use this in production.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'), | |
| app = express(); | |
| app.use(express.methodOverride()); | |
| app.use(express.bodyParser()); | |
| app.use(function(req, res, next) { | |
| res.header("Access-Control-Allow-Origin", "*"); | |
| res.header("Access-Control-Allow-Headers", "X-Requested-With, origin, x-csrftoken, content-type, accept"); | |
| res.header("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, OPTIONS"); | |
| next(); | |
| }); | |
| app.use(express.static(__dirname)); | |
| app.listen(3002); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment