reddog-code/RedDog.UI/vue.config.js

87 строки
2.1 KiB
JavaScript
Исходник Обычный вид История

2021-05-11 20:16:03 +03:00
const webpack = require("webpack");
const fetch = require("node-fetch");
2021-05-13 00:26:16 +03:00
// const axios = require('axios').default;
let MAKELINE_SERVICE = "http://127.0.0.1:5980/v1.0/invoke/make-line-service/method/orders/Redmond"
let ACCOUNTING_SERVICE = "http://127.0.0.1:5980/v1.0/invoke/accounting-service/method/OrderMetrics"
2021-05-13 00:26:16 +03:00
if (process.env.NODE_ENV === 'production'){
console.log('setting prod environment variables')
MAKELINE_SERVICE = "http://0.0.0.0:3500/v1.0/invoke/make-line-service/method/orders/Redmond"
ACCOUNTING_SERVICE = "http://0.0.0.0:3500/v1.0/invoke/accounting-service/method/OrderMetrics"
}else{
console.log('setting dev environment variables')
console.log(MAKELINE_SERVICE)
console.log(ACCOUNTING_SERVICE)
}
2021-05-11 20:16:03 +03:00
module.exports = {
lintOnSave: false,
configureWebpack: {
resolve: {
alias: {
// "chart.js": "chart.js/dist/chart.js"
2021-05-11 20:16:03 +03:00
}
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 6
}),
new webpack.DefinePlugin({
"process.env": {
}
})
]
},
devServer: {
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Headers":
"X-Requested-With, content-type, Authorization"
},
disableHostCheck: true,
host: "127.0.0.1",
public: "127.0.0.1:8080",
2021-05-11 20:16:03 +03:00
port: 8080,
2021-05-13 00:26:16 +03:00
before: (app)=> {
app.get('/orders/inflight', (req, res)=>{
2021-05-13 00:26:16 +03:00
fetch(MAKELINE_SERVICE)
.then(response => response.json())
.then(data => {
res.json(data).status(200)
})
2021-05-13 00:26:16 +03:00
})
app.get('/orders/metrics', (req, res)=>{
2021-05-13 00:26:16 +03:00
fetch(ACCOUNTING_SERVICE)
.then(response => response.json())
.then(data => {
res.json(data).status(200)
})
2021-05-13 00:26:16 +03:00
})
2021-05-11 20:16:03 +03:00
}
// proxy: devUrls,
},
pluginOptions: {
i18n: {
locale: "en",
fallbackLocale: "en",
localeDir: "locales",
enableInSFC: false
}
},
css: {
sourceMap: process.env.NODE_ENV !== "production"
}
};