I'm trying to get data from nest.js with vue.js. I getting this error:
Uncaught (in promise) TypeError: relativeURL.replace is not a function
Codes :
Api.js(vuejs)
import axios from "axios";
export default () => {
return axios.create({
baseURL: `http://localhost:5000`
});
}
Backend-connection.js(vuejs)
import Api from './Api'
export default {
getBasic(){
return Api().post({
headers : {
'Access-Control-Allow-Origin' : `*`,
}
});
}
}
app.controller.ts (nestjs)
import { Controller, Get, Post } from '@nestjs/common';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
get(): string {
return this.appService.getStarted();
}
@Post('/')
getPosts(): string {
return this.appService.getStarted();
}
}