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: {