JSFiddle - React, Tailwind, and code Playground
JavaScript
// Client call
$.ajax({
"url": "http://127.0.0.1:2013",
"type": "GET",
"dataType": "json",
"contentType": "application/json"
}).done(function(){
console.log("SUCCESS")
}).fail(function(){
console.log("ERROR");
});
// Nodejs Server code
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(204, {
"Access-Control-Allow-Headers":"Authorization, Content-Type",
"Access-Control-Allow-Methods": "PUT, GET, POST, DELETE, OPTIONS",
"Access-Control-Allow-Origin": "*"
});
res.end();
}).listen(2013, '127.0.0.1');