Skip to content

Commit a287343

Browse files
Merge pull request #4 from newaeonweb/added_cors_option
added cors headers
2 parents bbe6a42 + c0fd84b commit a287343

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ var http = require('http');
5454
// socket for sending data to the printer
5555
const Net = require('net');
5656

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

5865
// Main
5966
rest.get('/', function(req, res) {

0 commit comments

Comments
 (0)