NodeJs, VueJs post return 404 - PullRequest
       0

NodeJs, VueJs post return 404

0 голосов
/ 05 июня 2018

Я использую vue, vue-route, nodejs.Что мне нужно ?отправить данные формы в существующий файл JSON.Может быть, есть лучшая возможность, чем пост?

В данный момент я пытаюсь отправить запрос, но у меня проблема:

В моем роутере:

export default new Router({
mode: 'history',
routes: [
    {
        path: '/',
        name: 'test',
        component: HelloWorld
    },
    {
        path:'/add',
        name: 'add',
        component: Test
    }
]})

В моем компонентеHelloWorld.vue:

  axios({
                method: 'post',
                url: 'http://localhost:8080/add',
                data: {
                    name: this.config.persons.name,
                    phone: this.config.persons.phone,
                    email: this.config.persons.email
                }
            });

Возврат метода POST:

POST http://localhost:8080/add 404 (Не найдено)

...