X-Git-Url: https://git.r.bdr.sh/rbdr/generador-de-insultos/blobdiff_plain/1a652aac0ac1efc9100dd25e7da1105a4d515dc4..ba789de7be7c72749ba37e887c176b244660d3de:/bin/server.js 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) {