Quellcode durchsuchen

adding restana and 0http frameworks (#4932)

* adding restana and 0http frameworks

* adding required headers
Rolando Santamaria Maso vor 6 Jahren
Ursprung
Commit
a43d0e92f2

+ 9 - 0
frameworks/JavaScript/0http/0http.dockerfile

@@ -0,0 +1,9 @@
+FROM node:10-alpine
+
+WORKDIR /usr/src/app
+
+COPY app.js package.json ./
+
+RUN npm install
+
+CMD ["node", "app.js"]

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

@@ -0,0 +1,24 @@
+# 0http Benchmarking Test
+
+From https://www.npmjs.com/package/0http:
+
+> Cero friction HTTP request router. The need for speed!
+
+### Test Type Implementation Source Code
+
+* [JSON](app.js)
+* [PLAINTEXT](app.js)
+
+## Important Libraries
+The tests were run with:
+* [0http](https://www.npmjs.com/package/0http)
+* [NodeJS](https://nodejs.org/en/)
+
+## Test URLs
+### JSON
+
+http://localhost:8080/json
+
+### PLAINTEXT
+
+http://localhost:8080/plaintext

+ 25 - 0
frameworks/JavaScript/0http/app.js

@@ -0,0 +1,25 @@
+const cluster = require('cluster')
+const cpus = require('os').cpus()
+
+const cero = require('0http')
+const { router, server } = cero()
+
+router.on('GET', '/json', (req, res) => {
+  res.setHeader('server', '0http')
+  res.setHeader('content-type', 'application/json')
+
+  res.end(JSON.stringify({ message: 'Hello, World!' }))
+})
+
+router.on('GET', '/plaintext', (req, res) => {
+  res.setHeader('server', '0http')
+  res.setHeader('content-type', 'text/plain')
+
+  res.end('Hello, World!')
+})
+
+if (cluster.isMaster) {
+  cpus.forEach(() => cluster.fork())
+} else {
+  server.listen(8080)
+}

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

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

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

@@ -0,0 +1,7 @@
+{
+  "name": "0http",
+  "dependencies": {
+    "0http": "1.0.0"
+  },
+  "main": "app.js"
+}

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

@@ -0,0 +1,24 @@
+# Restana Benchmarking Test
+
+From https://www.npmjs.com/package/restana:
+
+> Blazing fast, tiny and minimalist connect-like web framework for building REST micro-services.
+
+### Test Type Implementation Source Code
+
+* [JSON](app.js)
+* [PLAINTEXT](app.js)
+
+## Important Libraries
+The tests were run with:
+* [restana](https://www.npmjs.com/package/restana)
+* [NodeJS](https://nodejs.org/en/)
+
+## Test URLs
+### JSON
+
+http://localhost:8080/json
+
+### PLAINTEXT
+
+http://localhost:8080/plaintext

+ 24 - 0
frameworks/JavaScript/restana/app.js

@@ -0,0 +1,24 @@
+const cluster = require('cluster')
+const cpus = require('os').cpus()
+
+const service = require('restana')()
+
+service.get('/json', (req, res) => {
+  res.setHeader('server', 'restana')
+  res.setHeader('content-type', 'application/json')
+  
+  res.end(JSON.stringify({ message: 'Hello, World!' }))
+})
+
+service.get('/plaintext', (req, res) => {
+  res.setHeader('server', 'restana')
+  res.setHeader('content-type', 'text/plain')
+
+  res.end('Hello, World!')
+})
+
+if (cluster.isMaster) {
+  cpus.forEach(() => cluster.fork())
+} else {
+  service.start(8080)
+}

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

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

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

@@ -0,0 +1,7 @@
+{
+  "name": "restana",
+  "dependencies": {
+    "restana": "^3.3.0"
+  },
+  "main": "app.js"
+}

+ 9 - 0
frameworks/JavaScript/restana/restana.dockerfile

@@ -0,0 +1,9 @@
+FROM node:10-alpine
+
+WORKDIR /usr/src/app
+
+COPY app.js package.json ./
+
+RUN npm install
+
+CMD ["node", "app.js"]