소개
게시글
질문&답변
2022.07.04
한글깨짐 발생하네요.
html은 안깨지고 mustache에서만 깨지네요. 차셋은 utf-8이긴 합니다.
- 0
- 4
- 311
질문&답변
2022.01.24
배포 후 모바일에서 로그인 안되는 문제.
지인에게 부탁해서 접속해봤는데 다른 폰 + 안드로이드 타블렛도 안되네요. 비밀번호 맞든 틀리든 excusemoa.com 내용: undefined라고 alert가 나오고 회원가입도 동작하지 않는것 보면(mysql에서 테이블 확인했는데 값 안들어오네요) 요청자체를 제대로 못보내거나 back에서 거부하고 있는것 같은데... 왜 모바일 브라우저에서만 그런건지 답답하면서 신기하네요 브라우저는 크롬, 삼성 이렇게 썼습니다. (둘다 크롬기반?) 아이폰이 없어서 사파리는 못써봤네요.
- 0
- 2
- 439
질문&답변
2022.01.20
우분투 mysql 계속 5.7로만 설치됩니다.
자문 자답입니다. https://www.inflearn.com/questions/41022 기존 mysql 5.7 깔린게 안지워져서 그런것같은데 ls로 파일목록보고 mysql-apt-config_0.8.12-1_all.deb가 있으면 sudo rm mysql-apt-config_0.8.12-1_all.deb 으로 지운 후에 sudo apt-get remove mysql-server 로 mysql 지워주고 위 링크안의 링크글 따라들어가서 명령어 따라치니 MYSQL 8로 설치가 되네요.
- 0
- 1
- 865
질문&답변
2021.12.17
시퀄라이즈 다대다관계 질문이 있습니다.
const User = sequelize . define ( 'User' , { // MySQL에는 users 테이블 생성 id : { // 사업자번호 type : DataTypes . STRING ( 30 ), allowNull : false , // 필수 unique : true , // 유일한 값 primaryKey : true , }, password : { // 비밀번호 type : DataTypes . STRING ( 100 ), allowNull : false , // 필수 }, company : { // 회사명 type : DataTypes . STRING ( 20 ), allowNull : false , // 필수 }, name : { // 담당자 이름 type : DataTypes . STRING ( 10 ), allowNull : true , }, phone : { // 담당자 전화번호 type : DataTypes . STRING ( 20 ), allowNull : true , }, email : { // 담당자 이메일 type : DataTypes . STRING ( 20 ), allowNull : true , }, role : { // 회원등급 type : DataTypes . STRING ( 15 ), defaultValue : "NOVICE" , // 비회원 NOVICE, 판매자 PROVIDER, 구매자 CUSTOMER, 판매-구매자 PROCUST, 관리자 ADMIN allowNull : false , // 필수 }, },{ charset : 'utf8' , collate : 'utf8_general_ci' // 한글 처리 }); User . associate = ( db ) => { // 릴레이션(관계) 정의 db . User . hasMany ( db . Address ); // 주소목록 db . User . hasMany ( db . Order ); // 주문내역 db . User . hasMany ( db . Item ); // 등록한 제품. db . User . belongsToMany ( db . User , { through: 'UsersRelation' , as: 'Providers' , foreignKey: 'customerId' }); // 판매자-구매자 관계 db . User . belongsToMany ( db . User , { through: 'UsersRelation' , as: 'Customers' , foreignKey: 'providerId' }); // 판매자-구매자 관계 db . User . belongsToMany ( db . Item , { through : 'ItemUsers' }); // 열람가능한 제품 }; // 고객등록 router . patch ( '/addcustomer' , isLoggedIn , async ( req , res , next ) => { // // front의 data: { providerId:string, customerId:string } console . log ( '고객등록' , req . body ); try { const customer = await User . findOne ({ // 아이디 찾기 where : { id : req . body . customerId , } }); const provider = await User . findOne ({ // 아이디 찾기 where : { id : req . body . providerId , } }); if (! customer || ! provider ) { return res . status ( 403 ). send ( '해당 아이디가 존재하지 않습니다.' ); } await provider . addCustomers ( req . body . customerId ); // await customer.addCustomers(req.body.providerId); res . status ( 200 ). json ({ customerId : req . body . customerId }); } catch ( error ) { console . error ( error ); next ( error ); // status 500 } }); CREATE TABLE IF NOT EXISTS `Users` (`id` VARCHAR(30) NOT NULL UNIQUE , `password` VARCHAR(100) NOT NULL, `company` VARCHAR(20) NOT NULL, `name` VARCHAR(10), `phone` VARCHAR(20), `email` VARCHAR(20), `role` VARCHAR(15) NOT NULL DEFAULT 'NOVICE', `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci; Executing (default): SHOW INDEX FROM `Users` FROM `excuse-moa` Executing (default): CREATE TABLE IF NOT EXISTS `UsersRelation` (`createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `providerId` VARCHAR(30) , `customerId` VARCHAR(30) , PRIMARY KEY (`providerId`, `customerId`), FOREIGN KEY (`providerId`) REFERENCES `Users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`customerId`) REFERENCES `Users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci; Executing (default): SHOW INDEX FROM `UsersRelation` FROM `excuse-moa` 테이블 drop한다음에 서버끄고 다시 하니까 이번엔 의도한대로 작동하네요.. 😅😯 답변 감사드립니다.....
- 0
- 2
- 278