[์ •๋ณด] ํฌ๋กค๋ง ์ฃผ์˜์‚ฌํ•ญ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
์„ธ์…˜์„ ๋ฌผ์–ด์„œ ํ†ต์‹ ํ•˜๋„๋ก ํ•˜์ž ์„ธ์…˜์—†์ด ์ง„ํ–‰ ์‹œ ์—ฐ๊ฒฐ์„ ๋งบ๊ณ  ๋Š์Œ์˜ ๋ฐœ์ƒ์œผ๋กœ ์„œ๋ฒ„์—์„œ ์ˆ˜์šฉ๊ฐ€๋Šฅํ•œ ๋ฒ„ํผ๊ฐ€ ์—†์–ด์„œ ์—ฐ๊ฒฐ์ด ๋Š์–ด์ง€๊ฑฐ๋‚˜ ๋ณด์•ˆ์žฅ๋น„์—์„œ ๊ณต๊ฒฉ์œผ๋กœ ์ธ์‹ํ•ด์„œ ์ฐจ๋‹จ ๋  ์ˆ˜ ์žˆ๋‹ค. session = requests.Session() session.get("URL") session.close()
[Nextjs] ์›ํ•˜์ง€ ์•Š๋Š” ๊ฐ์ฒด ์ œ์™ธํ•˜๊ณ  ๋ฐฐ์—ด json return ํ•˜๊ธฐ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
ํ•ด๊ฒฐ๋ฐฉ๋ฒ• ๊ฐ์ฒด๋ถ„ํ•ด ๋ฌธ๋ฒ•์„ ํ†ตํ•˜์—ฌ return ํ•œ๋‹ค export async function GET(request: NextRequest) { const result = await prismadb.user.findMany(); // Modify the result to exclude the 'hashedPassword' field const modifiedResult = result.map(({ hashedPassword, ...rest }) => rest); return NextResponse.json(modifiedResult); } const modifiedResult = result.map(({ hashedPassword, ...rest }) => rest);์—์„œ ๊ฐ์ฒด ๋ถ„ํ•ด๊ฐ€ ์ผ์–ด๋‚ฉ๋‹ˆ๋‹ค. ๊ตฌ์ฒด์ ์œผ๋กœ๋Š”..
[์ธ์ฆ์„œ] pfx ํŒŒ์ผ์—์„œ ์ธ์ฆ์„œ ๋ฐ ๊ฐœ์ธํ‚ค ์ถ”์ถœํ•˜๊ธฐ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
์ž‘์„ฑ๋ฐฐ๊ฒฝ ์ธ์ฆ์„œ ๊ต์ฒด ์ž‘์—…์ด ํ•„์š”ํ•œ ๋‚  IIS ํŒŒ์ผ ์ „์šฉ์œผ๋กœ pfx ํŒŒ์ผ๊ณผ keypass๋ฅผ ์ „๋‹ฌ ๋ฐ›์•˜๋‹ค. ๋‚˜๋Š” CloudFlare์˜ cert.pem, priv.key๋กœ ์ž‘์—…์„ ํ•ด์•ผํ•˜๋Š” ์ƒํ™ฉ์ด๋‹ค. pfx ํŒŒ์ผ์—์„œ ์ถ”์ถœํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์„ ์ฐพ์•„ ์ธ์ฆ์„œ ์ถ”์ถœ ๋ฐ ๊ฐœ์ธํ‚ค ์ถ”์ถœ์„ ํ•˜์—ฌ ์ •์ƒ์ ์œผ๋กœ ์ธ์ฆ์„œ ์ž‘์—…์„ ์™„๋ฃŒํ–ˆ๋‹ค! openssl ๋ช…๋ น์–ด๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ์ง€์•Š์•„์„œ wsl์˜ ๋„์›€์„ ๋ฐ›์•„ wget์œผ๋กœ wsl ์ธํ„ฐํŽ˜์ด์Šค ๊ฐ„ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ  ๋ฐ›์•„ ์ž‘์—…ํ–ˆ๋‹ค. ์ธ์ฆ์„œ์ถ”์ถœ(certification) openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [drlive.crt] ๊ฐœ์ธํ‚ค์ถ”์ถœ(private key) openssl rsa -in [drlive.key] -out [drlive-d..
[Nextjs] api return ๊ฐ’ ๊ฐฑ์‹  ์•ˆ๋˜๋Š” ์ด์œ 
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ/Next.js
์›์ธ fetch๋กœ api๋ฅผ ํ˜ธ์ถœ ์‹œ cache๋กœ ์ฒ˜๋ฆฌํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. dev ํ™˜๊ฒฝ์—์„œ๋Š” cache ์—†์ด ๊ฐฑ์‹ ๋˜์„œ ์ž˜๋˜์—ˆ์ง€๋งŒ production ํ™˜๊ฒฝ์—์„œ๋Š” cache๋กœ ๋ณ€๊ฒฝ์ด ๋˜์ง€ ์•Š์€ ๊ฒƒ์ด๋‹ค. prisma์˜ findMany findDelete๊ฐ€ ๊ณ ์žฅ๋‚œ์ค„ ์•Œ์•˜๋‹ค ํ•ด๊ฒฐ๋ฐฉ๋ฒ• api tsํŒŒ์ผ์— dynamic ์ง€์ • // /api/log/route.ts import prismadb from '@/app/libs/prismadb'; import { NextResponse } from 'next/server'; // ํ˜ธ์ถœ์‹œ cache ์—†์ด ์ˆ˜ํ–‰ export const dynamic = 'force-dynamic'; export async function GET(request: Request) { try { const l..
[nextjs] ์—‘์…€ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ/Next.js
nextjs์—์„œ ํ•˜๋„ api ๋‹จ์—์„œ ํŒŒ์ผ์„ ์ €์žฅํ•˜๊ณ  ๋‹ค์‹œ ๋ถˆ๋Ÿฌ์˜ค๊ณ  ๋ณ„ ์ง“์„ ํ•ด๋ณด์•˜์ง€๋งŒ ์ž˜ ๋˜์ง€์•Š์•„์„œ json ๋ฐฐ์—ด์„ ๋ฐ›์•„ ํ”„๋ก ํŠธ์—์„œ ์ €์žฅํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๋ณ€๊ฒฝํ–ˆ๋‹ค. ์ถœ์ฒ˜ https://kwtjdtn.tistory.com/9 [Javascript] xlsx๋ฅผ ์ด์šฉํ•˜์—ฌ json data๋ฅผ ์—‘์…€ ํŒŒ์ผ๋กœ ๋‹ค์šด๋กœ๋“œ ํ•˜๊ธฐ (์ดˆ๊ฐ„๋‹จ) ์–ด๋“œ๋ฏผ ์„œ๋น„์Šค์— JSON ๋ฐ์ดํ„ฐ๋ฅผ ์—‘์…€ ํŒŒ์ผ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋‹ค์šด๋กœ๋“œ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค. ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ฐฉ๋ฒ•๋“ค์ด ์žˆ๊ฒ ์ง€๋งŒ xlsx ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ด์šฉํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค. (๋„ˆ๋ฌด ๊ฐ„๋‹จํ•˜๊ธฐ ๋•Œ๋ฌธ,,) ๋ผ kwtjdtn.tistory.com import * as XLSX from 'xlsx'; const downloadExcel = (data) => { const worksheet = XLSX.ut..
[Nextjs] ํŒŒ์ผ ์—…๋กœ๋“œ(file upload)
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ/Next.js
ํด๋ผ์ด์–ธํŠธ const fileUpload = async (file: Blob) => { const formData = new FormData(); formData.append('file', file, file.name); // ํŒŒ์ผ ์ด๋ฆ„์„ ๋ช…์‹œ try { const res = await fetch('/api/upload', { method: 'POST', body: formData, }); const data = await res.json(); console.log('์„œ๋ฒ„ ์‘๋‹ต:', data); } catch (error) { console.error('ํŒŒ์ผ ์—…๋กœ๋“œ ์ค‘ ์˜ค๋ฅ˜:', error); } }; export default fileUpload; ์„œ๋ฒ„(api/upload/route.ts. import..
[์ •๋ณด] git commit ๋‚ด์—ญ ์ •๋ฆฌํ•˜๊ธฐ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
ํ•œ์ค„์š”์•ฝ ๋ธŒ๋žœ์น˜๋ฅผ ๊ณ ์•„๋กœ ๋งŒ๋“ค์–ด๋ผ ๊ทธ๋ฆฌ๊ณ  ์ƒˆ๋กœ์šด ๊ณณ์— ๋ฎ์–ด์จ๋ผ ํ•˜๋‚˜์˜ ๋ธŒ๋žœ์น˜๋ฅผ ๊ณ ์•„๋กœ ๋งŒ๋“ค๊ณ  ๊ฑฐ๊ธฐ์— ์ตœ์ดˆ ์ปค๋ฐ‹ํ•˜๊ณ  origin์„ ๋ฎ์–ด ์”Œ์šฐ๋Š” ๊ฒƒ์ด๋‹ค. protected branch๋ผ๋ฉด ํ•ด์ œ ํ•ด์•ผ ํ‘ธ์‹œ๋œ๋‹ค. git checkout --orphan latest_branch git add -A git commit -am "Initial commit message" #Committing the changes git branch -D master #Deleting master branch git branch -m master #renaming branch as master git push -f origin master #pushes to master branch git gc --aggressive --prune=..
[์ •๋ณด] next.js localhost:3000 ์ ‘์† ๋ถˆ๊ฐ€
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ/Next.js
ํ•ด๊ฒฐ๋ฐฉ๋ฒ• ํ”„๋กœ์ ํŠธ ํด๋”์•ˆ์˜ .next ํŒŒ์ผ์„ ์‚ญ์ œํ•˜๊ณ  npm run dev ์ˆ˜ํ–‰ ์›์ธ์„ค๋ช… next.js์— ์ฒ˜์Œ ์ž…๋ฌธํ•˜๊ณ  intellij๋ฅผ ํ†ตํ•ด์„œ ์ƒ˜ํ”Œ ํ”„๋กœ์ ํŠธ๋ฅผ dev๋กœ ์‹คํ–‰ํ•˜๊ณ ์ž ํ–ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ๋‚˜๋Š” http://localhost:3000์—์„œ ์„œ๋ฒ„๊ฐ€ ์‹คํ–‰๋˜์—ˆ๋‹ค๋Š” ๋ฉ”์‹œ์ง€๋งŒ ํ™•์ธํ•˜๊ณ  ์ž˜ ๋˜์—ˆ๋‚˜ ๋ณด๋‹ค๋ผ๊ณ  ํ•˜๊ณ  ์‹คํ–‰ํ–ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ ‘์†์ด ๋ถˆ๊ฐ€ํ•˜์˜€๋‹ค. ์™œ๋ƒํ•˜๋ฉด ์ •์ƒ์ ์œผ๋กœ ์„œ๋ฒ„๊ฐ€ ์˜ฌ๋ผ์˜ค๋ ค๋ฉด ์œ„์˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ๋‹ค ๋‚˜์™€์•ผํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์–ด์ฉŒ๋‹ค ๋ณด๋‹ˆ powershell ๋˜๋Š” ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ์—์„œ ์ž˜ ๋˜๋Š” ๊ฒƒ์„ ๋ณด์•„ ๋„ˆ๋ฌด ์˜์•„ํ•ด ํ–ˆ๋‹ค ๊ทธ๋Ÿฌ๋˜ ์™€์ค‘์— ํ•ด๊ฒฐ ๋ฒ•์„ ์ฐพ์•˜๋‹ค. ๋ฐ”๋กœ ํ”„๋กœ์ ํŠธ ํด๋”์•ˆ์˜ .next ํŒŒ์ผ์„ ์‚ญ์ œํ•˜๊ณ  npm run dev ์ˆ˜ํ–‰ํ•˜๋ฉด ๋˜๋Š” ๊ฒƒ์ด๋‹ค. https://stackoverflow.com/questions/7..
[์ •๋ณด] ๋‚˜์˜ ์›น ๊ฐœ๋ฐœ ์ปค๋ฆฌํ˜๋Ÿผ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
๋‚˜์˜ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์Šคํ‚ฌ ์Šคํƒ ๋ณ€ํ™” 4ํ•™๋…„ : Eclipse JSP/Servlet ๋ฉ‹ ๋ชจ๋ฅด๊ณ  ์‹œ์ž‘ํ•œ ์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์‚ฌํšŒ์ƒํ™œ 3๋…„์ฐจ : Eclipse, JSP/Servlet ํšŒ์‚ฌ์—…๋ฌด ํˆด์„ ๋งŒ๋“ค๊ฒŒ ๋˜๋‹ค ์‚ฌํšŒ์ƒํ™œ 4๋…„์ฐจ : Intellij, Mustache/Spring Boot ๋ฌด๋ฃŒ ํ…œํ”Œ๋ฆฟ์œผ๋กœ ํ™ˆํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ค๋‹ค. JPA๋ฅผ ์ตํžˆ๋‹ค ์‚ฌํšŒ์ƒํ™œ 5๋…„์ฐจ : Intellij, Thymeleaf/Spring Boot ํ…œํ”Œ๋ฆฟ์„ ๋ˆ์„ ์ฃผ๊ณ  ๊ตฌ์ž…ํ•˜๋‹ค. ๋‹ค ์ˆ˜์˜ ์„œ๋น„์Šค๋ฅผ ๋Ÿฐ์นญํ•˜๋‹ค. ์‚ฌํšŒ์ƒํ™œ 5๋…„์ฐจ : Intellij, Next.js(react), Spring Boot(Java) SPA์— ๋Œ€ํ•˜์—ฌ ์ ‘ํ•˜๋‹ค. ์ง€์†์ ์ธ Spring Boot ๋นŒ๋“œ์˜ ํ”ผ๋กœ๊ฐ์— ํƒˆํ”ผํ•˜์—ฌ ํ”„๋ก ํŠธ์—”ํŠธ ๊ฐœ๋ฐœ์˜ ์ด์ ์„ ๋ˆ„๋ ค๋ณด๊ณ ์ž ํ•œ๋‹ค.
[์ •๋ณด] ํƒ€์ž„๋ฆฌํ”„ ๋ณ€์ˆ˜ ์‚ฌ์šฉ(id, onclick )
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
html์ž‘์„ฑ ๋žœ๋”๋ง๊ฒฐ๊ณผ