Browse Source

Add /plaintext to express/hapi

Edward Bramanti 10 years ago
parent
commit
60f9c26653

+ 5 - 1
frameworks/JavaScript/express/app.js

@@ -106,7 +106,11 @@ if (cluster.isMaster) {
   // Routes
 
   app.get('/json', function(req, res) {
-    res.send({ message: 'Hello, World!' })
+    res.send({ message: 'Hello, World!' });
+  });
+
+  app.get('/plaintext', function(req, res) {
+    res.header('Content-Type', 'text/plain').send('Hello, World!');
   });
   
   app.get('/mongoose', function(req, res) {

+ 1 - 0
frameworks/JavaScript/express/benchmark_config.json

@@ -4,6 +4,7 @@
     "default": {
       "setup_file": "setup",
       "json_url": "/json",
+      "plaintext_url": "/plaintext",
       "port": 8080,
       "approach": "Realistic",
       "classification": "Micro",

+ 12 - 2
frameworks/JavaScript/hapi/app.js

@@ -69,13 +69,23 @@ if (cluster.isMaster) {
 			html: require('handlebars')
 		},
 		path: __dirname + '/views'
-	})
+	});
 
 	server.route({
 		method: 'GET',
 		path: '/json',
 		handler: function(req, reply) {
-			reply({ message: 'Hello, World!' })
+			reply({ message: 'Hello, World!' }).header('Server', 'hapi');
+		}
+	});
+
+	server.route({
+		method: 'GET',
+		path: '/plaintext',
+		handler: function(req, reply) {
+			reply('Hello, World!')
+			 .header('Server', 'hapi')
+			 .header('Content-Type', 'text/plain');
 		}
 	});
 

+ 1 - 0
frameworks/JavaScript/hapi/benchmark_config.json

@@ -4,6 +4,7 @@
     "default": {
       "setup_file": "setup",
       "json_url": "/json",
+      "plaintext_url": "/plaintext",
       "port": 8080,
       "approach": "Realistic",
       "classification": "Micro",