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
/** | |
* https://github.com/GoogleChromeLabs/comlink/blob/master/docs/examples/06-node-example/main.mjs | |
* https://github.com/GoogleChromeLabs/comlink/issues/476#issuecomment-642765445 | |
* esModuleInterop to true in tsconfig.json compilerOptions. | |
*/ | |
import { Worker } from 'worker_threads'; | |
import * as comlink from 'comlink'; | |
import nodeEndpoint from 'comlink/dist/umd/node-adapter'; | |
import { cpus } from 'os'; |
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 * as assert from 'assert'; | |
/** | |
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt | |
*/ | |
export class Base62 { | |
private readonly base: bigint = BigInt(62); | |
private readonly charset: string[] = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); | |
public encode(integer: string): 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
import * as assert from 'assert'; | |
import BigNumber from 'bignumber.js'; | |
class Base62 { | |
private readonly base: BigNumber = new BigNumber(62); | |
private readonly charset: string[] = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); | |
public encode(integer: string): string { | |
if (Number(integer) === 0) { | |
return '0'; |
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 http = require('http'); | |
const httpProxy = require('http-proxy'); | |
const _ = require('lodash'); | |
const virtualHost = { | |
// Proxy Web | |
'tested.co.kr': { target: { host: 'localhost', port: 8000 } }, | |
// Proxy WebSocket | |
'ws.tested.co.kr': { target: { host: 'localhost', port: 8010 }, ws: true }, | |
// Proxy Path |
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
'use strict'; | |
var db = require('./db'); | |
var testModel = require('./model'); | |
var testControllers = { | |
// 모델에서 db.single() 함수를 사용한 예제입니다. | |
// 쿼리를 실행하고 커넥션을 반환합니다. | |
test1: function (req, res) { | |
testModel.getTest('test1').then(function (rows) { |