瀏覽代碼

New JS framework - restify (#3623)

* restify

* restify
Nate 7 年之前
父節點
當前提交
38d4da035b

+ 24 - 0
frameworks/JavaScript/restify/README.md

@@ -0,0 +1,24 @@
+# Restify Benchmarking Test
+
+From [restify.com](http://restify.com):
+
+> A Node.js web service framework optimized for building semantically correct RESTful web services ready for production use at scale. restify optimizes for introspection and performance, and is used in some of the largest Node.js deployments on Earth.
+
+### Test Type Implementation Source Code
+
+* [JSON](server.js)
+* [PLAINTEXT](server.js)
+
+## Important Libraries
+The tests were run with:
+* [Restify](http://restify.com/)
+* [NodeJS](https://nodejs.org/en/)
+
+## Test URLs
+### JSON
+
+http://localhost:8080/json
+
+### PLAINTEXT
+
+http://localhost:8080/plaintext

+ 24 - 0
frameworks/JavaScript/restify/benchmark_config.json

@@ -0,0 +1,24 @@
+{
+  "framework": "restify",
+  "tests": [{
+    "default": {
+      "plaintext_url": "/plaintext",
+      "json_url": "/json",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "None",
+      "framework": "restify",
+      "language": "JavaScript",
+      "flavor": "NodeJS",
+      "orm": "Raw",
+      "platform": "nodejs",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "restify",
+      "notes": "",
+      "versus": "nodejs"
+    }
+  }]
+}

+ 7 - 0
frameworks/JavaScript/restify/package.json

@@ -0,0 +1,7 @@
+{
+  "name": "restify",
+  "dependencies": {
+    "restify": "7.1.1"
+  },
+  "main": "server.js"
+}

+ 8 - 0
frameworks/JavaScript/restify/restify.dockerfile

@@ -0,0 +1,8 @@
+FROM node:9.10.1
+
+WORKDIR /nextjs
+ADD ./ ./
+
+RUN npm install
+
+CMD node server.js

+ 17 - 0
frameworks/JavaScript/restify/server.js

@@ -0,0 +1,17 @@
+const cluster = require('cluster');
+const cpus = require('os').cpus();
+const server = require('restify').createServer();
+
+server.get('/plaintext', (req, res) =>
+  res.send('Hello, World!'));
+
+server.get('/json', (req, res) =>
+  res.json({ message: 'Hello, World!' }));
+
+
+if (cluster.isMaster) {
+  cpus.forEach(() => cluster.fork());
+} else {
+  server.listen(8080, () =>
+    console.log('%s listening at %s', server.name, server.url));
+}

+ 1 - 0
frameworks/JavaScript/restify/source_code

@@ -0,0 +1 @@
+.server.js