gileneusz
gileneusz

Reputation: 1485

vuejs setting API_URL inside dev.env.js gives unexpected "/$/"

I'm trying to set up API_URL variable to my dev.env.js file:

'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')

module.exports = merge(prodEnv, {
  NODE_ENV: '"development"',
  API_URL: '"http://127.0.0.1:8000/api"'
})

and use it for api calls:

this.$http.get('${process.env.API_URL}/companyAddress')

and somehow my server response me with error:

Response {url: "http://127.0.0.1:8000/api/$/companyAddress", 
ok: false, status: 405, statusText: "Method Not Allowed",

why is this happening? where does this "$" comes from?

Upvotes: 0

Views: 202

Answers (1)

gizyk
gizyk

Reputation: 151

Problem is here:

this.$http.get('${process.env.API_URL}/companyAddress')

And the answer is here: ES6 / ECMA6 template literals - not working

Upvotes: 1

Related Questions