Ahyoung Kim
@ahyoung2271214
Reviews Written
3
Average Rating
5.0
Posts
Q&A
์๋ ํ์ธ์! CORS ์๋ฌ ๋ฐ ๋ก๊ทธ์ธ issue ์ง๋ฌธ๋๋ฆฝ๋๋ค.
์, ์ ๋ก์ด๋, ๋๋์ด ํด๊ฒฐ๋์์ด์! mySQL ๋ฐ์ดํฐ๋ฅผ ๋ค ์ง์ฐ๊ณ ์ด๊ธฐํ ์ํค๊ณ ๋ค์ ํ๋๋ ๊ฑฐ์ง๋ง์ฒ๋ผ ์๋ํ๋ค์. ํฌ๊ธฐํ์ง ์๊ณ ๋์์ฃผ์ ์ ๊ฐ์ฌํด์:)
- 0
- 15
- 710
Q&A
์๋ ํ์ธ์! CORS ์๋ฌ ๋ฐ ๋ก๊ทธ์ธ issue ์ง๋ฌธ๋๋ฆฝ๋๋ค.
production์ผ๋ก ๋์ต๋๋คใ ใ ๋ต๋ณ ์ฃผ์ ์ ๊ฐ์ฌํด์! (์ฌ์ง)
- 0
- 15
- 710
Q&A
์๋ ํ์ธ์! CORS ์๋ฌ ๋ฐ ๋ก๊ทธ์ธ issue ์ง๋ฌธ๋๋ฆฝ๋๋ค.
credentials๋ก ๋ค์ ๋ฐ๊ฟ์ ๋๋ ค๋ณด๋ 80์ผ๋ก ๋จ๋ค์!
- 0
- 15
- 710
Q&A
์๋ ํ์ธ์! CORS ์๋ฌ ๋ฐ ๋ก๊ทธ์ธ issue ์ง๋ฌธ๋๋ฆฝ๋๋ค.
app.js ํ์ผ์ ๋๋ค. ํน์ credentials๋๋ฌธ์ ๊ทธ๋ฐ๊ฑฐ ์๋๊ฐ ํด์ cors ๋ถ๋ถ์ withCredential๋ก ๋ฐ๊พธ์ด๋ดค์ด์. const express = require('express');const cors = require('cors');const passport = require('passport');const session = require('express-session');const cookie = require('cookie-parser');const morgan = require('morgan');const hpp = require('hpp');const helmet = require('helmet');const dotenv = require('dotenv');const prod = process.env.NODE_ENV === 'production';const db = require('./models');const passportConfig = require('./passport');const userRouter = require('./routes/user');const postRouter = require('./routes/post');const postsRouter = require('./routes/posts');const hashtagRouter = require('./routes/hashtag');const app = express();dotenv.config();db.sequelize.sync();passportConfig();if(prod) { app.use(helmet()); app.use(hpp()); app.use(morgan('combined')); app.use(cors({ origin: 'http://simplestory.ga', withCredentials: true, }));} else { app.use(morgan('dev')) app.use(cors({ origin: 'http://localhost:3080', withCredentials: true, }));}app.use('/', express.static('uploads'));app.use(express.json());app.use(express.urlencoded({extended: false}));app.use(cookie(process.env.COOKIE_SECRET));app.use(session({ resave: false, saveUninitialized: false, secret: process.env.COOKIE_SECRET, cookie: { httpOnly: true, secure: false, domain: prod && '.simplestory.ga', },}));app.use(passport.initialize());app.use(passport.session());app.get('/', (req, res) => { res.status(200).send("New express app");})app.use('/user', userRouter);app.use('/post', postRouter);app.use('/posts', postsRouter);app.use('/hashtag', hashtagRouter);app.listen(prod? process.env.PORT : 3085, () => { console.log(process.env.PORT) console.log(`backend ${prod ? process.env.PORT : 3085} is ready`);});
- 0
- 15
- 710
Q&A
์๋ ํ์ธ์! CORS ์๋ฌ ๋ฐ ๋ก๊ทธ์ธ issue ์ง๋ฌธ๋๋ฆฝ๋๋ค.
npm start๋ก ์ ๋ ฅํ์ด์! (์ฌ์ง) (์ฌ์ง)
- 0
- 15
- 710
Q&A
์๋ ํ์ธ์! CORS ์๋ฌ ๋ฐ ๋ก๊ทธ์ธ issue ์ง๋ฌธ๋๋ฆฝ๋๋ค.
(์ฌ์ง) ์, ๋ต๊ธ์ด ๋๋ฝ๋์์๋ค์. .env์๋ ๋ฑํ ๋ฌธ์ ๋ ๋งํ๊ฒ ๋ณด์ด์ง ์๋๋ฐ ์ด๋์ ๋ถํฐ ํ์ด์ก๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ด์!
- 0
- 15
- 710
Q&A
์๋ ํ์ธ์! CORS ์๋ฌ ๋ฐ ๋ก๊ทธ์ธ issue ์ง๋ฌธ๋๋ฆฝ๋๋ค.
(์ฌ์ง) ํน๋ณํ ์ ๊ฐ ์ฝ๋๋ก ๋ฎ์ด์์ด๊ฒ์ ์๋ ๊ฒ ๊ฐ์๋ฐ... ๋ญ๊ฐ ๋ฌธ์ ์ผ๊น์?;;
- 0
- 15
- 710
Q&A
์๋ ํ์ธ์! CORS ์๋ฌ ๋ฐ ๋ก๊ทธ์ธ issue ์ง๋ฌธ๋๋ฆฝ๋๋ค.
์, ์ ๋ง ์ค๋ซ๋์ ๊ณ ๋ฏผํ๋๋ฐ ๋ต๋ณ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! ๊ฐ์์์ ์๋ ค์ฃผ์ ๋๋ก package.json์์ NODE_ENV๋ฅผ production์ผ๋ก ๋ณ๊ฒฝํ๋ค๊ณ ์๊ฐํ๋๋ฐ app.js์ console.log๋ฅผ ์ฐ์ด๋ณด๋ NODE_ENV๊ฐ undefined๊ฐ ๋์ค๋ค์. ์ ๊ฐ ์๋ชป ์๊ฐํ ๊ฒ์ด ์์๊น์? (์ฌ์ง)
- 0
- 15
- 710
Q&A
nuxtServerInit์ด ์๋ํ์ง ์์ต๋๋ค.
์, ๊ทธ๋ ๋ค์. async await ๋ฌธ๋ฒ์ ์๋ชป ์์ฑํ์๋ค์! ๊ฐ์ฌํฉ๋๋ค!
- 0
- 2
- 320
Q&A
npm run lint ์คํ์ ์ค๋ฅ ๋ฐ์ํฉ๋๋ค babel์ด๋ ์๋ง๋๋ณธ๋ฐ์ใ
์ ๋ ๋๋ถ์ ์ ๊ณ ์ณค์ต๋๋ค! ๊ฐ์ฌํฉ๋๋ค.
- 0
- 19
- 4.9K




