반응형

Framework/Node.js 4

Node / express / SQL Server / MS SQL database/Sequelize 사용 연결 / 로그인 / 회원가입

설치 해야 하는 것 npm install --save connect-redis; //레디스 연결을 위한 모듈 npm install --save sequelize; // 데이터베이스와 node.js ORM시켜줌 npm install --save sequelize-cli; // 커맨드라인 인터페이스 - 터미널 명령어로 관리도 가능하게 해줌 npm install --save redis; //Redis node_modules/.bin/sequelize init init을 하면 models folder와 config폴더가 생긴다. models- index.js(아래 참고)가 생기고 거기에 각종 내가 설정하고 싶은 것을 설정한다. config/config.json(아래 참고)에서는 데이터베이스 정보를 넣는다. //..

Framework/Node.js 2021.06.11

Node.js - TinyMCE WYSIWYG 에디터 Image를 클라우드에 Upload하기(feat. Azure storage)

참고 : https://www.tiny.cloud/docs/general-configuration-guide/upload-images/ 위 사이트를 참고하여 Ajax 함수를 가져옴. XMLhttprequest.open을 routes/index.js에 있는 /tinymce 로 하여 거기서 클라우드에 업로드한다. 아래 코드는 클라이언트쪽에서 tineMCE 호출하는 것. //views/tineMCE.pug extends layout block content div(class="service__list") textarea(id="editor" rows="2" class="form-control") welcome input(name="image" type="file" id="upload" class="hidden..

Framework/Node.js 2021.05.22

Node.js - query INSERT INTO [table] (column) values 넣기

Node.js 에서 local database 연결하여 데이터 집어 넣기를 해보았다. //config/Database.js var mysql = require('mysql'); module.exports = function () { return { init: function () { return mysql.createConnection({ host: 'localhost', port: '3306', user: 'root', password: '', database: 'chat_db' }) }, test: function (con) { con.connect(function (err) { if (err) { console.error('Error :' + err); } else { console.info('Co..

Framework/Node.js 2021.05.12

노드.제이에스 기본 내장 함수 Node.js Fundamental

//__dirname - pwd 느낌, 현재 위치(경로) - path to current directory // __filename - file name // require - 모듈을 사용하기 위한 함수 function to use modules(CommonJS) // module - 현재 모듈에 대한 인포 info about current module (file) // process - 프로그램이 실행 되는 환경변수의 인포 info about env where the program is being executed //names.js const secret = 'SUPER SECRET' const john = 'john' const peter = 'peter' module.exports = {john,p..

Framework/Node.js 2021.04.30
반응형