From 56f4bf98f74d89d7b1632744e15afe3d0f048ccb Mon Sep 17 00:00:00 2001 From: AxelFasst Date: Wed, 19 Jan 2022 18:36:08 +0100 Subject: [PATCH] dockerisation is ok, waiting for communication for front and back --- docker-compose.yml | 6 +++--- server/package-lock.json | 1 - web-client/Dockerfile | 2 +- web-client/src/index.js | 14 +++++++++++--- web-client/src/pages/Dashboard.js | 30 +++++++++++++++++------------- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4f17d43..f6c83fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.9' +version: '3.3' services: web-client: build: ./web-client @@ -6,7 +6,7 @@ services: - 3000:3000 volumes: - ./web-client:/app - - /app/node_modules + # - /app/node_modules api: build: ./server @@ -20,7 +20,7 @@ services: database: image: mysql environment: - MYSQL_ROOT_PASSWORD: 1995Posse + MYSQL_ROOT_PASSWORD: ready16160 MYSQL_DATABASE: wildmine # volumes: # - $HOME/Desktop/MySQL-Snippets/school.sql:/school.sql diff --git a/server/package-lock.json b/server/package-lock.json index 1a28530..c6c904f 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "server", "version": "1.0.0", "license": "ISC", "dependencies": { diff --git a/web-client/Dockerfile b/web-client/Dockerfile index 0db2bf8..c91f1c9 100644 --- a/web-client/Dockerfile +++ b/web-client/Dockerfile @@ -7,4 +7,4 @@ RUN npm install COPY . ./ -CMD npm start \ No newline at end of file +CMD npm run start \ No newline at end of file diff --git a/web-client/src/index.js b/web-client/src/index.js index 508bc8c..b1931ea 100644 --- a/web-client/src/index.js +++ b/web-client/src/index.js @@ -4,12 +4,20 @@ import './css/style.css'; import App from './App.js'; import reportWebVitals from './reportWebVitals'; import { BrowserRouter } from "react-router-dom"; +import { ApolloClient, InMemoryCache, ApolloProvider } from "@apollo/client"; + +const client = new ApolloClient({ + uri: "/graphql", + cache: new InMemoryCache(), +}); ReactDOM.render( - - - + + + + + , document.getElementById('root') ); diff --git a/web-client/src/pages/Dashboard.js b/web-client/src/pages/Dashboard.js index f43641c..cd07425 100644 --- a/web-client/src/pages/Dashboard.js +++ b/web-client/src/pages/Dashboard.js @@ -1,23 +1,27 @@ -import { useQuery } from '@apollo/client'; -import gql from 'gql-tag'; +import { useQuery } from "@apollo/client"; +import gql from 'graphql-tag'; import React from 'react'; -// const getUser = gql` -// query getUsers { -// user { -// id -// first_name -// last_name -// } -// } -// `; +const getUser = gql` + query getUsers { + user { + id + first_name + last_name + } + } +`; -const onClickSubmit = async () => { - // console.log(await useQuery(getUser)); +const onClickSubmit = () => { + console.log('coucou'); }; + const Dashboard = () => { + const { loading, data } = useQuery(getUser); + return (
+ {console.log(data)} Hello Home!
);