장뽕뽕의 개발일기
close
프로필 배경
프로필 로고

장뽕뽕의 개발일기

  • 분류 전체보기 (158)
    • Java (61)
      • Springboot (28)
      • Architecture (0)
      • Algorithm (17)
      • Trouble-Shooting (3)
      • Basic (13)
    • Security (24)
      • Practice (4)
      • System (7)
      • Network (4)
      • Application (9)
    • Mobile (0)
      • Android (0)
      • Flutter (0)
    • JavaScript (16)
      • Node.js (16)
    • Linux (8)
    • Network (6)
    • Docker (4)
    • Project (5)
      • SecuriSuite (5)
    • Certificate (3)
      • 정보처리기사 (1)
      • 정보보안기사 (2)
    • Legacy (27)
      • JS+PHP+SQL (27)
    • 루트권한 없는 나의 하루 (4)
  • 홈
Node.js Express - CRUD 게시판 만들기 1

Node.js Express - CRUD 게시판 만들기 1

시작하기에 앞서 기존에 만들었던 건 메뉴로 분류해버렸습니다..그리고 게시판도 하나의 메뉴로 사용할 거예요! 이렇게 ㅋㅁㅋ파일 구조는 다음과 같습니다.  lib/db.js : DB 접속 관련 모듈router/board.js : 게시판 라우터view/board/~ : 게시판에 렌더링 될 페이지 게시판 DDL 정보CREATE TABLE `board` ( `idx` int(11) NOT NULL AUTO_INCREMENT, `writer` varchar(20) DEFAULT NULL, `password` varchar(20) DEFAULT NULL, `title` varchar(100) DEFAULT NULL, `content` text DEFAULT NULL, `date` datetime DEFAU..

  • format_list_bulleted JavaScript/Node.js
  • · 2025. 2. 19.
  • textsms

Node.js Express - Mysql DB 접속

노드에서 Mysql을 사용하려면 Mysql 모듈을 먼저 설치해야 됩니다.npm install mysql 설치 후에 바로 연결을 해봐요. 저는 데이터베이스 설정 관련 부분을 따로 모듈화 시켜서 사용했습니다.​lib/db.jsvar mysql = require('mysql');var db = mysql.createConnection({ host : '호스트주소', user : '유저', password : '비밀번호', database : 'DB', dateStrings: "date",});db.connect();module.exports = db;  db 변수에 연결할 때 사용되는 정보를 입력해 준 뒤 connect() 메서드가 mysql에 연결합니다.query('sql',callback) 을 통해 질의문..

  • format_list_bulleted JavaScript/Node.js
  • · 2025. 2. 18.
  • textsms
Node.js Express - 이미지 불러오기

Node.js Express - 이미지 불러오기

업로드한 이미지를img src 태그로 출력해 볼게요.img src="폴더/파일명"으로 하면 출력이 안될 거예요.먼저 노드에서 정적 파일을 제공해 줘야 됩니다.저는 upload 폴더 안에 이미지를 업로드했습니다. app.js//imgapp.use(express.static('upload')) index.ejs  logo.png랑 1671157986921_image.png는 동일한 이미지입니다.제일 첫 페이지 메인 섹션에 이미지 두 개만 출력했습니다.  귀여운 루피가 두 마리!!

  • format_list_bulleted JavaScript/Node.js
  • · 2025. 2. 18.
  • textsms
Node.js Express - 파일 업로드

Node.js Express - 파일 업로드

노드에서 폼데이터와 Multer를 이용하여 파일 업로드를 진행해 볼게요.하면서 파일 이름이 중복되면 안 되니까 파일 이름도 같이 바꿔보도록 할게요.. Multer 모듈을 먼저 설치해줍니다. npm install multer 하고 저는 업로드하는 Router를 따로 만들어 줬습니다. 프로젝트 구조  index.ejs에 파일 업로드 폼 추가 파일 업로드  upload.jsvar express = require('express');var router = express.Router();//multervar multer = require('multer');const storage = multer.diskStorage({ destination: function (req, file, cb) { cb(n..

  • format_list_bulleted JavaScript/Node.js
  • · 2025. 2. 18.
  • textsms
Node.js Express - JQuery 사용하기

Node.js Express - JQuery 사용하기

https://www.npmjs.com/ npm | HomeBring the best of open source to you, your team, and your company Relied upon by more than 17 million developers worldwide, npm is committed to making JavaScript development elegant, productive, and safe. The free npm Registry has become the center of Javawww.npmjs.com npm jquery 문서 노드에서 자바스크립트 라이브러리 jquery를 사용해 봐요.먼저 npm으로 jquery를 설치합니다.npm install jquery 설치 완료 ..

  • format_list_bulleted JavaScript/Node.js
  • · 2025. 2. 18.
  • textsms
Node.js Express - Routing

Node.js Express - Routing

라우팅은 HTTP 요청에 대한 응답하는 방법을 결정하는 것입니다.웹 페이지를 확장시켜 나가면서 코드가 길어지면 유지 보수하기가 상당히 까다롭습니다.그래서 노드에서 라우터를 분리하여 개발하는 것이 효율적입니다.분리하여 어떻게 모듈화할지는 개발자 나름입니다. 프로젝트 구조 router - index.js / result.jsrouter 폴더를 만들어서 라우터를 분리했습니다. index.js var express = require('express');var router = express.Router();router.get('/', function (req, res) { res.render('index');});module.exports = router; result.js var express = require..

  • format_list_bulleted JavaScript/Node.js
  • · 2025. 2. 18.
  • textsms
  • navigate_before
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • navigate_next
공지사항
  • 장뽕뽕 사이트를 오픈합니다.
  • 개발 일기 사이트 이전 안내
전체 카테고리
  • 분류 전체보기 (158)
    • Java (61)
      • Springboot (28)
      • Architecture (0)
      • Algorithm (17)
      • Trouble-Shooting (3)
      • Basic (13)
    • Security (24)
      • Practice (4)
      • System (7)
      • Network (4)
      • Application (9)
    • Mobile (0)
      • Android (0)
      • Flutter (0)
    • JavaScript (16)
      • Node.js (16)
    • Linux (8)
    • Network (6)
    • Docker (4)
    • Project (5)
      • SecuriSuite (5)
    • Certificate (3)
      • 정보처리기사 (1)
      • 정보보안기사 (2)
    • Legacy (27)
      • JS+PHP+SQL (27)
    • 루트권한 없는 나의 하루 (4)
최근 글
인기 글
최근 댓글
태그
  • #php
  • #javascript
  • #springboot
  • #SQL
  • #phpMyAdmin
  • #dothome
  • #html
  • #algorithm
  • #Spring
  • #java
전체 방문자
오늘
어제
전체
Copyright © 쭈미로운 생활 All rights reserved.
Designed by JJuum

티스토리툴바