]> git.r.bdr.sh - rbdr/generador-de-insultos/blobdiff - bin/server.js
Update README
[rbdr/generador-de-insultos] / bin / server.js
index b07aab4285c87607a6c07777c47db194ad865f01..00c23bbb8dc9325df89fdfd3c601bc9e2cd54257 100755 (executable)
@@ -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) {
 // Preload stuff, then run
 console.log("Loading template...");
 fs.readFile(path.resolve(__dirname, '../ext/index.html'), {encoding: 'utf8'}, function (err, contents) {