Skip to content

Commit 3fba2d4

Browse files
MaxBittkerzpao
authored andcommitted
added permissive CORS header middleware function
1 parent e74c2db commit 3fba2d4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ app.set('port', (process.env.PORT || 3000));
2323
app.use('/', express.static(path.join(__dirname, 'public')));
2424
app.use(bodyParser.json());
2525
app.use(bodyParser.urlencoded({extended: true}));
26+
app.use(function(req, res, next) {
27+
//set permissive CORS header
28+
res.setHeader('Access-Control-Allow-Origin', '*');
29+
next();
30+
});
2631

2732
app.get('/api/comments', function(req, res) {
2833
fs.readFile(COMMENTS_FILE, function(err, data) {

0 commit comments

Comments
 (0)