how to use express.router to access data in url? (vue)

Viewed 26

I have a file "app.vue" that implements a date picker for user to choose date:

//app.vue
<div id="q-app">
  <div class="q-pa-md" style="max-width: 300px">
      <q-input filled v-model="date" mask="date" :rules="['date']">
        <template v-slot:append>
          <q-icon name="event" class="cursor-pointer">
            <q-popup-proxy>
              <q-date v-model="date" ></q-date>
            </q-popup-proxy>
          </q-icon>
        </template>
      </q-input>
    </div>
</div>

import { ref } from 'vue'

export default {
  setup () {
    return {
      date: ref('2019/02/01')
    }
  }
  methods: {
    updateDate(){
      this.$router.push({
        name: this.$router.name,
        query: this.date,
}
</script>

I tested "app.vue" successfully updates user selected date to the url. I have another file "data.js" which is the backend, I want to get the user picked date, to do so, I try to access it like the following:

//data.js
const router = express.Router();

router.get("/", async function (req, res) {
   ...
   console.log("user input date", req.query);
}

But the req.query is always returning empty. Does anyone know why this is happening and how I can access the date data from "data.js"?

0 Answers
Related