X-Git-Url: https://git.r.bdr.sh/rbdr/generador-de-insultos/blobdiff_plain/1a652aac0ac1efc9100dd25e7da1105a4d515dc4..00d46287bf00b94b87b11497cfff90eb6985b78f:/bin/server.js?ds=inline diff --git a/bin/server.js b/bin/server.js index b07aab4..00c23bb 100755 --- a/bin/server.js +++ b/bin/server.js @@ -32,6 +32,22 @@ server.route({ } }); +server.route({ + config: { + cors: { + origin: ['*'], + additionalHeaders: ['cache-control', 'x-requested-with'] + } + }, + method: 'GET', + path:'/raw', + handler: function (request, reply) { + insults.generate().then(function (insult) { + reply(insult); + }); + } +}); + // Preload stuff, then run console.log("Loading template..."); fs.readFile(path.resolve(__dirname, '../ext/index.html'), {encoding: 'utf8'}, function (err, contents) {