Skip to content

Commit

Permalink
added cors headers
Browse files Browse the repository at this point in the history
  • Loading branch information
newaeonweb committed Dec 30, 2020
1 parent bbe6a42 commit c0fd84b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ var http = require('http');
// socket for sending data to the printer
const Net = require('net');

// cors option
rest.use(function(res, next) {
res.header("Access-Control-Allow-Origin", "http://localhost:3000"); // use your own domain
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Credentials", true)
next();
});

// Main
rest.get('/', function(req, res) {
Expand Down

0 comments on commit c0fd84b

Please sign in to comment.