TypeORM basic
const post = await myDataBase.getRepository(Post).findOneBy({
id: Number(req.params.id) // ์์ฒญ ํ๋ผ๋ฏธํฐ์ ์๋ id ๊ฐ์ ๊ฐ์ ธ์์ ์กฐ๊ฑด์ผ๋ก ๋ช
์
})POST
const post = new Post() // entity ์ ์์ฑํ๋๋ก Post ๊ฐ์ฒด ์์ฑ
post.title = req.body.title // ์์ฒญ ๋ฐ์ดํฐ ๋ด๋ถ์ title ๊ฐ๋๋ก ๊ฐ์ฒด ๊ฐ ์ง์
post.body = req.body.body // ์์ฒญ ๋ฐ์ดํฐ ๋ด๋ถ์ body ๊ฐ๋๋ก ๊ฐ์ฒด ๊ฐ ์ง์ ์ญํ
๋ฉ์๋ ์ด๋ฆ
Last updated