본문 바로가기

기타233

이걸 까먹네 jquery option:selected 내가 자주 사용하는 패턴중 하나가 select에 data로 데이터 밀어넣고 그값 가져오는걸 많이 사용하는데 맨날 기억에서삭제되는 패턴이 이거다 와.. 이걸 해냅니다 셀렉터가 $("#sel option:selected") option:selected 이런거 본적은 있는거같은지 모르겠는데.. 맨날 까먹는 패턴이다 $("#sel option:selected").data("idx") -> 요값을 콘솔로 찍어보면 11이 나온다. 그렇다면 선택된값에 이것저것 원하는 정보를 존나 쳐넣고 땡겨오면 된다. 2019. 6. 28.
multer 1. 원하는것file을 업로드하여 저장하고싶다.2. 검색검색결과 multer에 대한 추천내용이 많았다.https://www.npmjs.com/package/multer3. 적용사용법에 대한 한글문서https://github.com/expressjs/multer/blob/master/doc/README-ko.md 설치$ npm install --save multer const multer = require("multer");//파일저장위치 지정 및 파일용량 조절const upload = multer({ dest: 'public/uploads/',limits: { fileSize: 5 * 1024 * 1024 }}); app.post('/upload',upload.single('img_file'), func.. 2018. 8. 9.
Express에서 정적 파일 제공 1. 저장된 이미지를 불러오고싶다.2. Express에서는 정적 파일 제공을 이용한다.http://expressjs.com/ko/starter/static-files.html 해당형태로 추가해주면 접근이 가능하다.app.use('/static', express.static(__dirname + '/public')); http://localhost:3000/statc/images/test1.jpg 이미지외에도 정적파일을 전부 가져오는게 가능하다. 2018. 8. 9.
cors 1. 에러 Failed to load http://AAAA: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://BBB' is therefore not allowed access. The response had HTTP status code 404.2. 원인현재 도메인과 다른 도메인에서 리소스가 요청될경우 보안상으 이유로 데이터를 받을 수 없다.RESTful API기반으로 통신할때 API서버와 웹서버의 페이지가 달라서 CORS제한이 걸리게된다. 자세한 설명은 요기서 https://developer.mozilla.org/ko/docs/Web/HTTP/Access_control_CORS CORS.. 2018. 8. 9.
mysql2 MYSQL2 https://github.com/sidorares/node-mysql2https://www.npmjs.com/package/mysql2 설치npm install --save mysql2First Query// get the clientconst mysql = require('mysql2'); // create the connection to databaseconst connection = mysql.createConnection({ host: 'localhost', user: 'root',//원본 소스에는 비밀번호부분이 없다password : '000000' database: 'test'}); // simple queryconnection.query( 'SELECT * FROM `table.. 2018. 8. 8.
pm2 PM2http://pm2.keymetrics.io/https://www.npmjs.com/package/pm2 일반전인 웹 애플리케이션을 배포할때는 WAS를 이용한다. 하지만 node의 경우 자체 웹서버의 기능이 존재하여 WAS나 웹서버를 이용할 필요가 없다. node의경우 그냥 node index 의 명령어를 이용하면 애플리케이션이 시작된다. 해당 형태로 시작하게되면 커맨드창을 지속적으로 켜두거나 서버가 뻗어버렸을경우 답이없다. PM2에 나와있는 설명OverviewWhy use PM2 ? At the end of this overview, you will better understand the benefits of using PM2 as a process manager.Forever AlivelinkO.. 2018. 8. 7.
https://jestjs.io/ 모카는 써봤는데 기존 개발자가 테스트툴로 Jest를 사용해놓은걸 봤다.https://jestjs.io/ 일단 보긴 해야될거같은데 모카랑 뭐가 다른지 확인해봐야될거같다. 추가정보 : https://github.com/GoogleChrome/puppeteer 를 통해서 크롤링을 하는 부분이있었는데 디버깅쪽 하는부분이jest와 jasmine,mocha를 추천해준거같은데https://github.com/smooth-code/jest-puppeteer puppeteer에서 디버깅할때 편해서 사용하지 않았나 싶다. 2018. 8. 2.
each each문을쓸때 break, continue for문이나 while문을 사용시break와 continue문을 자주사용하게되는데 each문에서는 break가 존재하지 않는다.https://api.jquery.com/each/ 결론 : return false; samplevar flag = true;var msg = "if문에 걸리지 않았어요";$("input").each(function(i,e){if($(e).val() == "aaa"){flag = false;msg = "aaa를 쓰지 말아요"return false; //break의 역할을 하게된다.}}) alert(msg); 2018. 7. 30.
개인용 vue-webpack-boilerplate Framework7 + vuejs https://github.com/framework7io/framework7-template-vue-webpack + cordovahttps://github.com/AppointmentGuru/webpack-mobile-f7https://vuetifyjs.com/ko/ --https://github.com/AppointmentGuru/webpack-mobile-f7 해당버전을 fork하여 템플릿제작 -> 구버전이라 사용XModule build failed: Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'---버전을 어떻게 맞추는게 좋을것인가..---https://github.com/.. 2018. 6. 18.