Skip to content

Instantly share code, notes, and snippets.

View alpharder's full-sized avatar
:shipit:

Alex Bolshakov alpharder

:shipit:
View GitHub Profile
@paulomcnally
paulomcnally / subdomain.js
Last active March 6, 2019 13:31
Create file server/boot/subdomain.js and edit server/model-config.json to add "tenant": true property on every model. Only work with loopback-connector-postgresql and schema.
'use strict';
var modelConfig = require('../model-config.json');
module.exports = function(app) {
app.use(function(req, res, next) {
// set tenant based subdomain or use public
var subdomain = (req.subdomains.length > 1) ? req.subdomains.pop() : req.subdomains[0];
var tenant = req.subdomains.pop() || 'public';
@Aschen
Aschen / README.md
Last active January 17, 2025 05:31
Benchmarking AsyncLocalStorage

What is the overhead of AsyncLocalStorage?

Run the benchmark:

$ npm i benchmark

# Run the AsyncLocalStorage benchmark
$ node async-local-storage.js ASL
ASL x 15,551 ops/sec ±3.30% (79 runs sampled)