Browse Source

Allowed CORs

Brendan Abolivier 8 years ago
parent
commit
e3d386972f
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      server.js

+ 8
- 0
server.js View File

@@ -31,6 +31,14 @@ app.use(bodyParser.urlencoded({ extended: true }));
31 31
 app.use(bodyParser.json());
32 32
 
33 33
 
34
+// Allow cross-origin requests. Wildcard for now, we'll see if we can improve
35
+// that.
36
+app.all('/*', function(req, res, next) {
37
+    res.header('Access-Control-Allow-Origin', '*');
38
+    next();
39
+});
40
+
41
+
34 42
 // A request on /register generates a token and store it, along the user's
35 43
 // address, on the tokens object
36 44
 app.get('/register', function(req, res, next) {