2021-05-11 20:16:03 +03:00
|
|
|
const webpack = require("webpack");
|
2021-05-12 00:24:47 +03:00
|
|
|
const fetch = require("node-fetch");
|
2021-05-13 00:26:16 +03:00
|
|
|
// const axios = require('axios').default;
|
|
|
|
|
|
|
|
|
2021-05-14 18:07:21 +03:00
|
|
|
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: {
|
2021-05-17 18:05:51 +03:00
|
|
|
// "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,
|
2021-05-14 18:07:21 +03:00
|
|
|
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)=> {
|
|
|
|
|
2021-05-12 00:24:47 +03:00
|
|
|
app.get('/orders/inflight', (req, res)=>{
|
2021-05-13 00:26:16 +03:00
|
|
|
|
|
|
|
fetch(MAKELINE_SERVICE)
|
2021-05-12 00:24:47 +03:00
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
res.json(data).status(200)
|
|
|
|
})
|
2021-05-13 00:26:16 +03:00
|
|
|
|
2021-05-12 00:24:47 +03:00
|
|
|
})
|
2021-05-12 19:07:35 +03:00
|
|
|
|
|
|
|
app.get('/orders/metrics', (req, res)=>{
|
2021-05-13 00:26:16 +03:00
|
|
|
|
|
|
|
fetch(ACCOUNTING_SERVICE)
|
2021-05-12 19:07:35 +03:00
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
res.json(data).status(200)
|
|
|
|
})
|
2021-05-13 00:26:16 +03:00
|
|
|
|
2021-05-12 19:07:35 +03:00
|
|
|
})
|
2021-05-12 00:24:47 +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"
|
|
|
|
}
|
|
|
|
};
|