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 ioredis from 'ioredis'; | |
import { DateTime } from 'luxon'; | |
interface IRedisOption { | |
expire: number | false; | |
} | |
type IRedisResponse<T> = IRedisHaveDataSuccessResponse<T> | IRedisNotHaveDataSuccessResponse | IRedisFailureResponse; | |
interface IRedisCommonResponse { |
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 array = []; | |
array.reduce((promise, payload) => { | |
return promise.then(() => { | |
// something await function do | |
}); | |
}, Promise.resolve()); |
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
// Singleton.js | |
class Singleton { | |
constructor(initValue = 0) { | |
this.value = initValue; | |
} | |
setValue(value) { | |
this.value += value; | |
} | |
getValue() { | |
return this.value; |
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 knex = require('knex')({ | |
client: 'mysql', | |
connection: { | |
host: 'hostname', | |
user: 'usernmae', | |
password: 'password', | |
database: 'dbname', | |
}, | |
}); | |
const fetch = require('node-fetch'); |
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 express from 'express'; | |
import fetch from 'node-fetch'; | |
const app = express(); | |
app.get('/error/:number', (request, response) => { | |
try { | |
const result = occurError(request.params.number); | |
response.json(result); | |
} catch (error) { |
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 config from 'getconfig'; | |
import knex from 'knex'; | |
import mongoose from 'mongoose'; | |
import { User, Log } from './domainObjects'; | |
import { Log as LogSchema } from './mongodbSchemas'; | |
class MySQL { | |
constructor() { | |
this.driver = knex(config.DATABASE.MYSQL); | |
} |
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 Money { | |
constructor(value) { | |
if (value < 0) throw Error('Money Type Valiation Exception'); | |
this.value = value; | |
} | |
} | |
class Email { | |
constructor(email) { | |
const regExp = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i; |
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 A { | |
constructor(value) { | |
this.value = value | |
} | |
adder() { | |
this.value += 1; | |
} | |
} | |
const v = new A(10); |
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
<!DOCTYPE html> | |
<html lang="ko"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Oops !!</title> | |
<!-- Fonts --> |
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 path = require('path'); | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
path: path.resolve(__dirname, 'public/'), | |
filename: 'bundle.js', | |
}, |
NewerOlder