index.js
app.get('/users/data', (req, res) => {
console.log('서버도착')
db.collection('user').find().toArray((err, data) => {
if(err) return console.log('에러', err)
if(data) res.json(data)
});
});
module.exports = {
path: '/app',
handler: app
};
--------------------------------------------------------------------------------------
index.vue
async fetch() {
await this.$axios.$get('/app/users/data').then(data =>{
this.userData = data;
}).catch((error)=>{
console.log(error.data)
});
},
yarn dev를 사용해서 열렸을 때 처음에만 화면이 보여지고, 이후로는 404만 뜨네요,,ㅜㅜ
index.js에서 app.get('/' , function ~~ 이 부분에서 html파일 말고 vue파일을 sendFile해줄 수 있는 방법은 없는걸까요,..??