Skip to content

Instantly share code, notes, and snippets.

View haykerman's full-sized avatar
🎯
Focusing

Hayk Baghdasaryan haykerman

🎯
Focusing
  • Tidepool Labs Europe
  • Yerevan, Armenia
View GitHub Profile
@haykerman
haykerman / http2.js
Created April 16, 2019 14:20 — forked from davidgilbertson/http2.js
HTTP2 server with compression and caching
const http2 = require('http2');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const brotli = require('brotli'); // npm package
const PORT = 3032;
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/');
const cache = {};