๋ชฉ๋ก๐ฉ๐ป ๋ฐฑ์๋(Back-End) (156)
๐ ๊ณต๋ถํ๋ ์ง์ง์ํ์นด๋ ์ฒ์์ด์ง?
=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ user ๋ฐ์ดํฐ ์ญ์ ํ๊ธฐ ๐ง routes/routes.js const express = require("express"); const router = express.Router(); const User = require("../models/user"); const multer = require("multer"); const fs = require("fs"); const { resourceLimits } = require("worker_threads"); // image upload var storage = multer.diskStorage({ //..
=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ ๋๊ธฐ(synchronous) : ์ง๋ ฌ์ ์ผ๋ก ํ์คํฌ๋ฅผ ์ํ : ์์ฒญ์ ๋ณด๋ธ ํ ์๋ต์ ๋ฐ์์ผ์ง๋ง ๋ค์ ๋์์ด ์ด๋ฃจ์ด์ง๋ ๋ฐฉ์ (ํ์คํฌ๋ฅผ ์ฒ๋ฆฌํ ๋์ ๋๋จธ์ง ํ์คํฌ๋ ๋๊ธฐ) ๐ฅ ๋น๋๊ธฐ (asynchronous) : ๋ณ๋ ฌ์ ์ผ๋ก ํ์คํฌ๋ฅผ ์ํ : ์์ฒญ์ ๋ณด๋ธ ํ ์๋ต์ ์๋ฝ ์ฌ๋ถ์๋ ์๊ด์์ด ๋ค์ ํ์คํฌ๊ฐ ๋์ํ๋ ๋ฐฉ์ (a ํ์คํฌ๊ฐ ์คํ๋๋ ์๊ฐ ๋์ b ํ์คํฌ ํจ) : ๋น๋๊ธฐ ์์ฒญ์ ์๋ต ํ ์ฒ๋ฆฌํ '์ฝ๋ฐฑ ํจ์' ์๋ ค์ค => ํด๋น ํ์คํฌ๊ฐ ์๋ฃ๋์์ ๋, '์ฝ๋ฐฑ ํจ์'๊ฐ ํธ์ถ๋จ โ ํ์ ์ฒ๋ฆฌ ๋ฉ์๋ 1) Promise then (Promise ๋ฐํ) ..
=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ datatables https://datatables.net/download/ : ๊ฒ์๊ธฐ๋ฅ, ์ด๊ฑด์, ํ์ด์ง๋น๊ฑด์, ์ด์ /๋ค์ ํ์ด์ง ์ด๋, ์ปฌ๋ผ๋ณ ์ ๋ ฌ, ํ๋ ํฌ๋งท, ์ผ์ชฝ/๊ฐ์ด๋ฐ/์ค๋ฅธ์ชฝ ์ ๋ ฌ ๋ฑ์ ์ ๊ณต ๐ฅ CDN https://cdnjs.com/ : Content Delivery Nerwork์ ์ฝ์ : ์น์ฌ์ดํธ์ ์ ์์๊ฐ ์ฝํ ์ธ ๋ฅผ ๋ค์ด๋ก๋ํ ๋ ์๋์ผ๋ก ๊ฐ์ฅ ๊ฐ๊น์ด ์๋ฒ์์ ๋ค์ด๋ก๋ํ ์ ์๋๋ก ํ๋ ๊ธฐ์ ๐ฅ MongoDB์ user Data ๋ฃ์ด์ง๊ณ , html์ ๋ฑ๋ก๋๋ ๊ณผ์ ๐ง views/index.ejs ID Image Name E-mai..
=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ ์ด๋ฏธ์ง ์ ๋ก๋ (multer) ์ํค๊ณ ๋ฉ์ธ ํ์ผ๋ก redirect ๐ง routes/routes.js const express = require("express"); const router = express.Router(); const User = require("../models/user"); const multer = require("multer"); // image upload var storage = multer.diskStorage({ // ํ์ผ์ด ์ ๋ก๋๋ ๊ฒฝ๋ก ์ค์ destination: function (req, file, cb) { c..
=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ ๋ฉ์ธ ํ์ด์ง ์๋จ ๋ชฉ๋ก ํ ์ก๊ธฐ ๐ง views/index.ejs ID Image Name E-mail Phone Action 1 gani gani@test.com 010-1234-1234
=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ ejs๋ก addUsers ํ์๊ฐ์ ํผ ๋ง๋ค๊ธฐ ๋ถํธํธ๋ฉ ์ฌ์ฉํจ https://cdnjs.com/ ๐ง views/addUsers.ejs Add New User Name Email Phone Select Image
=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ ejs๋ก html ๊พธ๋ฏธ๊ธฐ ejs๋ Embedded JavaScript Template์ ์ฝ์๋ก nodejs ์ง์์์ ๋ง์ด ์ฌ์ฉํ๋ ํ ํ๋ฆฟ ์์ง index.ejs๋ก ํ๊บผ๋ฒ์ ๊พธ๋ช์ง๋ง ๋ฉ์ธ (index) => footer๊ณผ header๋ก ๋๋์ด์ index ์์ ํฉ์นจ ์ ์ (addUsers) => ์ ์ ๋ฑ๋กํ๋ ํ์ด์ง ๋ถํธํธ๋ฉ ์ฌ์ฉํจ https://cdnjs.com/ ๐ง views/layout/header.ejs GANI Home Add user About Contact ๐ง views/layout/footer.ejs ๐ง views/layout/inde..
=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ index์ router ์ฐ๊ฒฐํ๊ธฐ ๐ง models/user.js const mongoose = require("mongoose"); const userSchema = new mongoose.Schema({ name : { type : String, required : true, }, email : { type : String, required : true, }, phone : { type : String, required : true, }, image : { type : String, required : true, }, created : { typ..