
Vue.js로 작업한 프론트엔드 작업물을 node.js express 에 배포하는 방법입니다 아래와 같은 구조로 작업한 상태라고 가정합니다 디렉토리 구조가 다르다면 ouptutDir등을 적절히 입력하면 됩니다 $ tree -L 1 . ├── front └── server front: Vue.js 프론트엔드 server: Node.js express 백엔드 1. 배포 위치 수정 - vue.config.js 수정 const path = require('path') module.exports = defineConfig({ // ... outputDir: path.resolve('../server/public'), // ... }) 2. 배포 npm run build 위 명령어를 수행하면 프론트를 구성하는 파일..

서버 실행 유지 및 상태 확인을 위한 pm2 를 인스톨하고 사용하는 방법 1. 설치 npm install pm2 -g 2. 시작 # npm start // 기존 실행 pm2 start npm -- start // pm2로 실행 3. 모니터링 $ pm2 monitor [PM2 I/O] Using non-browser authentication. [PM2 I/O] Do you have a pm2.io account? (y/n) n [PM2 I/O] No problem ! We just need few informations to create your account [PM2 I/O] Please choose an username : {login user name} [PM2 I/O] Please choose a..
1. 설치 npm install mongoose 2. DB 연결 const mongoose = require('mongoose') mongoose.connect(`mongodb://{HOST}:{PORT}/{DB}`, { keepAlive: true, keepAliveInitialDelay: 30000 }) 3. schema 정의 및 모델 생성 const schema = mongoose.Schema({ name: String, age: Number, // ... }) const User = mongoose.model('user', schema) 4. find // 1. query 리턴 const query = User.find({}) // mongoose.Query 리턴 const doc = query...
- Total
- Today
- Yesterday