Skip to content

Instantly share code, notes, and snippets.

@ktmihs
ktmihs / console.js
Last active March 14, 2023 01:23
console test example
const colorList = [
{id: 100, color: 'violet', icon: '๐Ÿ’œ'},
{id: 101, color: 'orange', icon: '๐Ÿงก'},
{id: 102, color: 'yellow', icon: '๐Ÿ’›'},
{id: 103, color: 'green', icon: '๐Ÿ’š'},
{id: 104, color: 'blue', icon: '๐Ÿ’™'},
]
console.log(colorList);
console.table(colorList);
@ktmihs
ktmihs / readline.js
Created January 7, 2023 08:07
readline template (๋ฐฑ์ค€ node input, softeer node input)
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const input = [];
const solution = () => {
let answer = '';
@ktmihs
ktmihs / index.txt
Created November 22, 2022 14:07
github
# ๋ธŒ๋žœ์น˜ ์ด๋ฆ„์ด ๋‹ค๋ฅผ ๋•Œ, push ํ•˜๋Š” ๋ฐฉ๋ฒ•
git push [remote] [origin branch]:[remote branch]
@ktmihs
ktmihs / hospitals.ctrl.js
Last active September 3, 2021 08:09
[node.js/Koa][React] ๋ฐฐ์—ด ํ•ญ๋ชฉ ํ•˜๋‚˜ ์‚ญ์ œ
import Hospital from "../../models/hospital"
// ๋ณ‘์›์—์„œ ์˜ˆ์•ฝ๋œ ์‹œ๊ฐ„ ์‚ญ์ œ
export const removeTime = async (ctx) => {
const { _id, reservationTime } = ctx.params
let hospital
try {
hospital = await Hospital.findOneAndUpdate(
{ _id: _id }, // id๋กœ ๊ฒ€์ƒ‰ํ•ด์„œ
{
@ktmihs
ktmihs / hospitals.ctrl.js
Last active September 3, 2021 08:09
[node.js/Koa][React] ๋ฐฐ์—ด ํ•ญ๋ชฉ ํ•˜๋‚˜ ์ถ”๊ฐ€
import Hospital from "../../models/hospital"
// ๋ณ‘์›์—์„œ ์˜ˆ์•ฝ๋œ ์‹œ๊ฐ„ ์ถ”๊ฐ€
export const updateTime = async (ctx) => {
const { _id, reservationTime } = ctx.params
let hospital
try {
hospital = await Hospital.findOneAndUpdate(
{ _id: _id }, // id๋กœ ์ฐพ์•„์„œ
{
@ktmihs
ktmihs / imageUpload.js
Last active September 3, 2021 08:10
[node.js/Koa][React] ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ
import React,{useState} from 'react'
...
function imageUpload(){
const formData=new FormData()
// FormData์— data์ถ”๊ฐ€๋Š” append(key, value)๋กœ ๋„ฃ์–ด์คŒ
const [image,setImage]=useState('')
const [form,setForm]=useState(new FormData)
const config = { // server๋กœ ๋ณด๋‚ด์ค„ config ๋ฏธ๋ฆฌ ์ž‘์„ฑ
headers: {