ktw23786330
@ktw23786330
Reviews Written
10
Average Rating
5.0
Posts
Q&A
Image CDN ๊ฐ๋ ๊ด๋ จ ์ง๋ฌธ
๋๊น์ง ๋ค์ ๋ฃ๋ค๋ณด๋ unsplash๊ฐ Image CDN์ ์ญํ ์ ํด์ฃผ์ จ๋ค๊ณ ํ์ฌ ์ฒซ ๋ฒ์งธ ์ง๋ฌธ์๋ ๊ตณ์ด ๋ตํด์ฃผ์ง ์์ผ์ ๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค ใ ใ .. ์ฃ์กํฉ๋๋ค! ๋ ๋ฒ์งธ ์ง๋ฌธ์๋ง ๋ต๋ณ ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค. ๊ฐ์ฌ๋ ์ข์ ๊ฐ์ ์ ๊ณตํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค :)
- 1
- 2
- 1.8K
Q&A
๋ก๊ทธ์ธ ๊ด๋ จ ๋ฌธ์
import { createWrapper } from 'next-redux-wrapper'; import { applyMiddleware, compose, createStore } from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension'; import createSagaMiddleware from 'redux-saga'; import reducer from '../reducers'; import rootSaga from '../sagas/index'; const loggerMiddleware = ({ dispatch, getState }) => (next) => (action) => { console.log(action); }; const configureStore = () => { const sagaMiddleware = createSagaMiddleware(); const enhancer = process.env.NODE_ENV === 'production' ? compose(applyMiddleware(sagaMiddleware)) : composeWithDevTools(applyMiddleware(sagaMiddleware, loggerMiddleware)); // ๋ฐฐํฌ์ฉ์ผ ๋๋ devTools๋ฅผ ์ฐ๊ฒฐํ์ง ์๊ณ ๊ฐ๋ฐ์ฉ์ผ ๋๋ง devTools๋ฅผ ์ฐ๊ฒฐ const store = createStore(reducer, enhancer); store.sagaTask = sagaMiddleware.run(rootSaga); return store; }; const wrapper = createWrapper(configureStore, { debug: process.env.NODE_ENV === 'development', // ์ดํ์ ๋ฐฐํฌํ ๋ production์ผ๋ก ๋ฐ๊ฟ์ฃผ๊ธฐ }); export default wrapper; import { createWrapper } from 'next-redux-wrapper'; import { applyMiddleware, createStore, compose } from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension'; import createSagaMiddleware from 'redux-saga'; import reducer from '../reducers'; import rootSaga from '../sagas'; const loggerMiddleware = ({ dispatch, getState }) => (next) => (action) => { console.log(action); return next(action); }; const configureStore = () => { const sagaMiddleware = createSagaMiddleware(); const middlewares = [sagaMiddleware, loggerMiddleware]; const enhancer = process.env.NODE_ENV === 'production' ? compose(applyMiddleware(...middlewares)) : composeWithDevTools(applyMiddleware(...middlewares)); const store = createStore(reducer, enhancer); store.sagaTask = sagaMiddleware.run(rootSaga); return store; }; const wrapper = createWrapper(configureStore, { debug: process.env.NODE_ENV === 'development', }); export default wrapper; ์์ ๊ฐ์๋ store/configureStore.js๋ฅผ ์๋์ ์ ๋ก์ด ์ ์๋ ์ฝ๋๋ฅผ ๋ณต์ฌํ๊ณ ๋๋ ๋ก๊ทธ์ธ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ต๋๋ค. ์ ๋ฌด์์ด ๋ฌธ์ ์์๊น์
- 0
- 1
- 213
Q&A
์ด๋ฏธ์ง ๋ฆฌ์ฌ์ด์ง 403 forbidden
ํน์ ์ด๋ฏธ์ง ๋ฆฌ์ฌ์ด์ง ์๋์๋ ๋ถ๋ค์ ํ์ผ ์ด๋ฆ์ด 'ํ๊ธ'์ด๋ผ์ ์ธ์ฝ๋ฉ ๋ฌธ์ ๋ก ๋์ง ์์ผ์ค ํ๋ฅ ์ด ๋์ต๋๋ค! encodeURIComponent๋ก ํ์ผ ์ด๋ฆ์ ๊ฐ์ธ์ฃผ๋ฉด ์ ์์ ์ผ๋ก ์ธ์ฝ๋ฉ๋๋๋ฐ, ํ๊ธ์ ์ธ์ฝ๋ฉํ๋ฉด ์ด๊ธฐ์ ์ค์ ํ๋ image ํ ์ด๋ธ์ src ์ปฌ๋ผ 200๊ธ์๋ฅผ ๋์ด๊ฐ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ drop table ํด์ฃผ์๊ณ 3~400์ ์ ๋๋ก ์ปฌ๋ผ ์ค์ ๋ณ๊ฒฝํด์ฃผ์๋ฉด ๋ชจ๋ ์ฌ์ง์ด ์ ์ ๋ก๋๋ ๊ฒ๋๋ค...!!
- 0
- 2
- 819
Q&A
github์ผ๋ก clone ํด์จ ํ npx webpack ์ค๋ฅ
์ ํด๊ฒฐํ์ต๋๋ค!
- 0
- 1
- 246
Q&A
aws ๋ฐฐํฌ์ ์๋ฌ
์ helmet ์ค์ ์ด true๋ก ๋์ด์์๋ค์. ๊ฐ์ฌํฉ๋๋ค!!!
- 0
- 2
- 306
Q&A
ํ ์คํธ ์ปค๋ฒ๋ฆฌ์ง ํ์ผ ์ด๋ฆ
(์ฌ์ง) ํฐ๋ฏธ๋ ๋๋ฆฌ๋๊น ๋ค์ ์ ๋๋ก ๋์ค๋ค์! ๊ฐ์ฌํฉ๋๋ค!
- 0
- 2
- 293
Q&A
์ข์์ ๊ธฐ๋ฅ ๊ตฌํ ๋ฌธ์
router.get('/hashtag', async (req, res, next) => { const query = req.query.hashtag; if (!query) { return res.redirect('/'); } try { const hashtag = await Hashtag.findOne({ where: { title: query } }); let posts = []; if (hashtag) { posts = await hashtag.getPosts({ include: [{ model: User, attributes: ['id', 'nick'] }] }); } return res.render('main', { title: `${query} ๊ฒ์ ๊ฒฐ๊ณผ | NodeBird`, twits: posts, likes: twits.map((v) => v.Liker.map((v) => v.id)).includes(req.user.id), }); } catch (error) { console.error(error); return next(error); } }); ์์ ๊ฐ์ด res.render๋ฅผ ํตํด likes ๋ฐฐ์ด์ ๋ฐ์์๊ณ , ์ด๋ฅผ ์ด์ฉํด {% if user and not (twit and likes) %} button class='like'>์ข์์button> {% elif user and (twit and likes) %} button class='unlike'> ์ข์์ ์ทจ์button> {% endif %} ์์ ๊ฐ์ด ๋์ ์ค ํ์ผ์ ๋ง๋ค์์ต๋๋ค. document.querySelectorAll('.like').forEach(function(tag){ tag.addEventListener('click',function(){ const isLoggedIn = document.querySelector('#my-id'); const twitId = tag.parentNode.querySelector('.twit-id').value; if (isLoggedIn){ axios.post(`/post/${twitId}/like`) .then(()=>{ location.reload(); }) .catch((error)=>{ console.error(error); }); } }); }); document.querySelectorAll('.unlike').forEach(function(tag){ tag.addEventListener('click',function(){ const isLoggedIn = document.querySelector('#my-id'); const twitId = tag.parentNode.querySelector('.twit-id').value; if (isLoggedIn){ axios.delete(`/post/${twitId}/like`) .then(()=>{ location.reload(); }) .catch((error)=>{ console.error(error); }); } }); }); like ๋ฒํผ๊ณผ unlike ๋ฒํผ์ ์ด๋ฒคํธ ๋ฆฌ์ค๋๋ ์์ ๊น์ด ๋ง๋ค์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ค์ ๋ก Like ํ ์ด๋ธ์ ์กฐํํด๋ณด๋ ์๋์ ๊ฐ์ด ์ข์์ ๋ฒํผ์ ๋๋ฅธ ์ฌ๋๋ค์ด ์กฐํ๊ฐ ๋ฉ๋๋ค. (์ฌ์ง) ๊ทธ๋ฐ๋ฐ ๋ฌธ์ ๋ ์ข์์ ๋ฒํผ์ ๋๋ฌ๋ ์ข์์ ์ทจ์ ๋ฒํผ์ผ๋ก ๋ฐ๋์ง ์์ต๋๋ค. ๋์ ์ค ํ์ผ์์ if์ elif ๋ฌธ์ ์๋ชป ์์ฑํ ๊ฒ์ธ์ง ์ด๋ฒคํธ ๋ฆฌ์ค๋๋ฅผ ์๋ชป ๊ตฌ์ฑํ ๊ฒ์ธ์ง ์ค๋ฅ๊ฐ ๋จ๋ ๊ฒ๋ ์๋๋ค๋ณด๋ ์ ํํ ์ด์ ๋ฅผ ์ฐพ์ง ๋ชปํ๊ฒ ์ต๋๋ค...
- 0
- 3
- 782
Q&A
์ข์์ ๊ธฐ๋ฅ ๊ตฌํ ๋ฌธ์
[Line 53, Column 80] parseSignature: expected comma after expression Template render error: (C:\Users\USER\git\Node.js\nodejsStudy\lecture\nodebird\views\main.html) [Line 53, Column 80] parseSignature: expected comma after expression๋ผ๊ณ ์ค๋ฅ๊ฐ ๋ฐ์ํ๊ณ ์ค๋ฅ๊ฐ ๋ฐ์ํ ์ค์ ์ฝ๋๋ {% set like = user and twit and twit['Liker'].map(function(value){ return value.id }).includes(user.id) %} ์ ๋๋ค! ํน์ res.render๋ฅผ ์ด์ฉํ ํด๊ฒฐ๋ฐฉ์์ ๋ํด ์กฐ๊ธ๋ง ๋ ์ค๋ช ํด์ฃผ์ค ์ ์์๊น์?
- 0
- 3
- 782




