안녕Ȣ16;세요 . Node js /196; 프/196;1229;트르 Ȣ16;나 만들고 1080;습니다만, 1656;문1060; 1080;Ǻ12; 글1012; 올/140;봅니다.160;
160;요런식1004;/196; 사용1088;가 값1012; 1077;/141;Ȣ16;면 (GET 0169;식) DB 에서 찾아서 결과가 위 사1652;처/100; 나왔1004;면 1339;,192;습니다.160;
구글 왠만한 ,160;색1008; 다 해봤lj16;데 1200;런식에 코드lj16; 없더라구요... 참고할만한 코드도 없구요..12640;12640; 1200;럴ǐ16; Ǻ12;떻,172; 코드를 1089;성해야 Ȣ16;나요.?감사합니다 :)
router.get('/check/:data', (req, next) => {
let data = req.body.data
ÀÌ·±½ÄÀ¸·Î µ¥ÀÌÅ͸¦ ¹Þ¾Æ¿À¼Å¼ .. ¾Æ·¡Ã³·³ üũ ÇÏ½Ã¸é µÉ°Í °°½À´Ï´Ù.
})
https://blog.naver.com/PostView.nhn?blogId=psj9102&logNo=221777739584&categoryNo=40&parentCategoryNo=0&viewDate=¢´tPage=1&postListTopCurrentPage=1&from=postView
import mysql from "mysql2/promise" // ±âº» ±â´ÉÀ» »ç¿ëÇÏ·Á¸é mysql2À» °¡Á®¿Â´Ù.
const connection = mysql.createPool({
host: host,
user: user,
password: password,
connectionLimit: 4,
databse: db,
})
const result = async () => {
const conn = connection.getConnection();
try {
const [row] = await conn.query("SELECT * FROM TABLE WHERE id = 4")
return row
} catch (e) {
throw new Error(e)
} finally {
conn.release() // pool À» µ¹·ÁÁÖ´Â ¿ªÇÒÀ» ÇÑ´Ù.
}
}
return row ¿¡¼
rowÀÇ °¹¼ö¸¦ °¡Á®¿Í¼ .. 1 ÀÌ»óÀÌ¸é °ªÀÌ ÀÖ´Ù°í / ¾Æ´Ï¸é °ªÀÌ ¾ø´Ù°í ¹ÝȯÇÏ½Ã¸é µÉ°Í °°½À´Ï´Ù.
(rowÀÇ °¹¼ö¸¦ °¡Á®¿Í¼ .. 1 ÀÌ»óÀÌ¸é °ªÀÌ ÀÖ´Ù°í / ¾Æ´Ï¸é °ªÀÌ ¾ø´Ù°í ¹ÝȯÇÏ½Ã¸é µÉ°Í °°½À´Ï´Ù )¿ä ¹®ÀåÀÌ °áÁ¤ÀûÀ¸·Î ´äÀÌ µÇ¾ú½À´Ï´Ù
µµ¿òÁּż °¨»çÇÕ´Ï´Ù :)