본문 바로가기

분류 전체보기

nodejs pkg pkg 프로젝트 빌드 목적으로 가장 널리 사용되는 도구 설치 sudo npm install -g pkg 사용 pkg . 설정 package.json "name": "your-app-name", "bin": { "your-app-name": "./main.js" },
Nodejs schedule 설치 npm install node-schedule 사용 utils/tmps_cleaner.js const schedule = require('node-schedule'); const fs = require('fs'); const path = require('path'); const folder_path = './tmps'; function clearTempFolder(directory) { const timeThreshold = new Date().getTime() - 5 * 60 * 1000; // 여기에서는 5분 이전의 파일만 삭제합니다. fs.readdir(directory, (err, files) => { if (err) throw err; for (const file of files) { co..
Nodejs dotenv detenv 의 역할 환경설정을 관리 설치 npm install dotenv 사용 main.js require('dotenv').config(); const httpPort = process.env.HTTP_PORT; const httpsPort = process.env.HTTPS_PORT; const dbHost = process.env.DB_HOST; .env HTTP_PORT=5000 HTTPS_PORT=6000 DB_HOST=www.example.co.kr
Ubuntu ssh sudo apt install openssh-client ssh 사용자명@원격PC주소
PWA service worker service_worker.js const sCacheName = 'hello-pwa'; // 캐시 제목 선언 const aFilesToCache = [ // 캐시할 파일 선언 './', './index.html', './manifest.json', './images/hello-pwa.png' ]; // 서비스 워커 설치하고 캐시 파일 저장 self.addEventListener('install', (pEvent) => { console.log('서비스 워커 설치함!'); pEvent.waitUntil( caches.open(sCacheName) .then((pCache) => { console.log('파일을 캐시에 저장함!'); return pCache.addAll(aFilesToCache); }) ..