๋ชฉ๋ก๐ฉ๐ป ๋ฐฑ์๋(Back-End) (156)
๐ ๊ณต๋ถํ๋ ์ง์ง์ํ์นด๋ ์ฒ์์ด์ง?

=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ MongoDB Compass ์ฐ๊ฒฐ ๐ง MongoDB ์ฐ๊ฒฐ ํ Database ์์ฑ ๐ง .env ์ MONGODB_URI ์ถ๊ฐ ๐ฅ Express-session ์ฐ๊ฒฐ : ์ธ์ ๊ด๋ฆฌ์ฉ ๋ฏธ๋ค์จ์ด 1. ํ์ผ์ ์ ์ฅ 2. DB์ ์ ์ฅ 3. Memory ์ ์ ์ฅ ๐ง index.js // imports require("dotenv").config(); const express = require("express"); const mongoose = require("mongoose"); const session = require("express-session"); /..

=> CRUD App With Image Upload Using NodeJs, ExpressJs, MongoDB & EJS Templating Engine ๐ฅ ๊ฐ๋ฐ ํ๊ฒฝ ๐ง npm init - npm : Node Package Manager์ ์ฝ์๋ก nodejs์ ๋ชจ๋ ๊ด๋ฆฌ - init : package.json ์์ฑ - package.json : npm์ ํตํด ์ค์น๋ ํจํค์ง ๋ชฉ๋ก์ ๊ด๋ฆฌ, ํ๋ก์ ํธ์ ์ ๋ณด ๋ฐ ์คํ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ๋ ํ์ผ ๐ง npm install ๐ง npm i express mongoose express-session ejs multer dotenv - express : ์น ํ๋ ์์ํฌ - mongoose : ๋น๋๊ธฐ ํ๊ฒฝ์์ ์๋ํ๋๋ก ์ค๊ณ๋ MongoDB ๊ฐ์ฒด ๋ชจ๋ธ๋ง ๋๊ตฌ - expre..

https://www.youtube.com/watch?v=ZEg03f1o_vQ&list=LL&index=6 ์~ ๋ ์ด๋ ต๋ค โญ ํ์ผ ๊ตฌ์กฐ โญ ์ธ๋ถ ํ์ผ ๐ปconfig/db.config.js module.exports = { db : "mongodb+srv://~~~~~~~" } ๐ปcontrollers/user.controller.js 'use strict'; // ๋น๋ฐ๋ฒํธ๋ฅผ ์ํธํํด์ ์ ์ฅํ๊ธฐ const bcryptjs = require("bcryptjs"); const userSesrvice = require("../services/user.services"); exports.register = (req, res, next) => { const {password} = req.body; // ์ํธ + ๋น..
โญ MVC ํจํด Model : ๋ฐ์ดํฐ๋ฒ ์ด์ค View : ๋์ ๋ณด์ด๋ ํ๋ฉด Controller : ์ด๋, ์ ์ฅ โญ REST API GET localhost:3000/write => ๊ธ์ฐ๋ ํ์ด์ง ์ด๋ POST localhost:3000/write => ์์ฑํ ๊ธ ๋ด์ฉ ์ ์ฅ

https://www.youtube.com/watch?v=mL84PLyKss0&list=PLSK4WsJ8JS4cQ-niGNum4bkK_THHOizTs&index=8 โญ Router ์ฌ์ฉํ๊ธฐ routes ํด๋ ๋ง๋ค๊ธฐ routes/home/index.js "use strict"; const express = require("express"); const router = express.Router(); router.get("/", (req, res) => { res.render("home/index"); }); router.get("/login", (req, res) => { res.render("home/login"); }); // ๋ด๋ณด๋ด๊ธฐ module.exports = router; app.js "use ..

https://www.youtube.com/watch?v=AZtyyeCwNoc&list=PLSK4WsJ8JS4cQ-niGNum4bkK_THHOizTs&index=5 ๐จ html ์๋ ์์ฑ html ํ์ผ์ ! + enter ๋๋ฅด๋ฉด ์๋์ผ๋ก html ๊ตฌ์กฐ ์ ๋ ฅ๋จ โญ ๋ก๊ทธ์ธ ํ๋ฉด (๋งค์ฐ ๊ตฌ์! ํ๋์ฝ๋ฉ) // const http = require("http"); // const app = http.createServer((req, res) => { // // ํ๊ธ๋ก ์ฝ์ด์ค // res.writeHead(200, {"Content-Type" : "text/html; charset=utf-8" }); // if (req.url === "/") { // res.end("์ฌ๊ธฐ๋ ๋ฃจํธ"); // } else if (r..

https://www.youtube.com/watch?v=7gF09WFGK4I&list=PLSK4WsJ8JS4cQ-niGNum4bkK_THHOizTs&index=4 โญ http๋ก ์๋ฒ ๊ฐ๋ const http = require("http"); const app = http.createServer((req, res) => { console.log(req.url); }); app.listen(3001, () => { console.log("http๋ก ๊ฐ๋๋ ์๋ฒ") }) โญ if ๋ฌธ์ผ๋ก ์๋ฒ ์ ์ด (ํ๊ธ ๊นจ์ง) const http = require("http"); const app = http.createServer((req, res) => { if (req.url === "/") { res.end("์ฌ๊ธฐ๋..

https://www.youtube.com/watch?v=7gF09WFGK4I&list=PLSK4WsJ8JS4cQ-niGNum4bkK_THHOizTs&index=3 โญ ์๋ฒ ๊ฐ๋ const express = require("express"); const app = express(); app.get("/", (req, res) => { res.send("์ฌ๊ธฐ๋ ๋ฃจํธ"); }); app.get("/login", (req, res) => { res.send("์ฌ๊ธฐ๋ ๋ก๊ทธ์ธ ํ๋ฉด"); }); app.listen(3000, function () { console.log("์๋ฒ ๊ฐ๋"); }); ์คํ์ํฌ ๋ ํญ์ node๋ฅผ ์ฌ์ฉํด์ ์๋ฒ๋ฅผ ๊ฐ๋์์ผ์ผํจ!!!!!