This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const sqlite3 = require('sqlite3'); | |
const db = new sqlite3.Database('../database/test.sqlite'); | |
app.get('/plaintext', function(req, res) { | |
res.setHeader('Content-Type', 'text/plain'); | |
res.send('Hello, World!'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 8701; | |
root /home/helper/laravel-tanner/benchmark/public; | |
index index.php index.html index.htm; | |
server_name 107.170.131.198; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$app->get('/plaintext', function() { | |
return 'Hello, world!'; | |
}); | |
$app->get('/json', function() { | |
return [ | |
'array' => [1, 2, 3], | |
'dict' => [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use DB; | |
Route::get('/plaintext', function() { | |
return 'Hello, world!'; | |
}); | |
Route::get('/json', function() { | |
return [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
get 'plaintext' => 'benchmark#plaintext' | |
get 'json' => 'benchmark#json' | |
get 'sqlite-fetch' => 'benchmark#sqlite' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
production: | |
<<: *default | |
database: /home/helper/database/test.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BenchmarkController < ActionController::Base | |
def plaintext | |
render plain: "Hello world" | |
end | |
def json | |
a = [1, 2, 3] | |
d = {"one" => 1, "two" => 2, "three" => 3} | |
r = {"array" => a, "dict" => d, "int" => 42, "string" => "test", "double" => 3.14, "null" => nil} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vapor | |
import Fluent | |
import FluentSQLite | |
let app = Application() | |
do { | |
let driver = try SQLiteDriver(path: "/home/helper/database/test.sqlite") | |
Database.default = Database(driver: driver) | |
} catch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public typealias Byte = UInt8 | |
public struct Data { | |
public var bytes: [Byte] | |
public init(_ bytes: [Byte]) { | |
self.bytes = bytes | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Vapor | |
/** | |
* This protocol defines router objects that can be used to relay | |
* different paths to the application | |
*/ | |
public protocol RouterDriver { | |
func route(request: Request) -> Request.Handler? |