diff --git a/devfile.yaml b/devfile.yaml index f1da0f1..25db012 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -12,6 +12,20 @@ projects: components: + - type: dockerimage + image: sebi2706/uppercase-sg-service + memoryLimit: 32M + env: + - value: '8082' + name: QUARKUS_HTTP_PORT + endpoints: + - name: uppercase-sg-service + port: 8082 + attributes: + path: /touppercase?p=uppercase%20service + + + - alias: quarkus-backend-dev type: dockerimage image: quay.io/quarkus/centos-quarkus-maven:20.1.0-java11 diff --git a/node-frontend/src/components/Post.js b/node-frontend/src/components/Post.js index 7a32e59..86297ba 100644 --- a/node-frontend/src/components/Post.js +++ b/node-frontend/src/components/Post.js @@ -16,6 +16,7 @@ class Post extends React.Component { timestamp: this.props.timestamp, } this.deletePost = this.deletePost.bind(this); + this.toUppercase = this.toUppercase.bind(this); } render() { @@ -38,7 +39,10 @@ class Post extends React.Component { + + @@ -63,6 +67,16 @@ class Post extends React.Component { window.location.reload(); } + toUppercase() { + fetch(`touppercase?p=${encodeURI(this.state.title)}`, { + method: 'GET' + }) + .then(response => response.text()) + .then(data => { + this.state.title = data; + this.setState(this.state); + }) + } } export default Post \ No newline at end of file diff --git a/node-frontend/src/setupProxy.js b/node-frontend/src/setupProxy.js index 1332a9c..a429496 100644 --- a/node-frontend/src/setupProxy.js +++ b/node-frontend/src/setupProxy.js @@ -22,5 +22,24 @@ module.exports = function (app) { }) ); + + var uppercase_quarkus_host = 'localhost'; + var uppercase_quarkus_port = '8082'; + + if (process.env.COMPONENT_QUARKUS_UPPERCASE_HOST) { + uppercase_quarkus_host = process.env.COMPONENT_QUARKUS_UPPERCASE_HOST; + } + + if (process.env.COMPONENT_QUARKUS_UPPERCASE_PORT) { + uppercase_quarkus_port = process.env.COMPONENT_QUARKUS_UPPERCASE_PORT; + } + + app.use( + '/touppercase', + createProxyMiddleware({ + target: `http://${uppercase_quarkus_host}:${uppercase_quarkus_port}`, + changeOrigin: true + }) + ); };