Skip to content

Commit

Permalink
dockerisation is ok, waiting for communication for front and back
Browse files Browse the repository at this point in the history
  • Loading branch information
AxelFasst committed Jan 19, 2022
1 parent 55b8098 commit 56f4bf9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 21 deletions.
6 changes: 3 additions & 3 deletions docker-compose.yml
@@ -1,12 +1,12 @@
version: '3.9'
version: '3.3'
services:
web-client:
build: ./web-client
ports:
- 3000:3000
volumes:
- ./web-client:/app
- /app/node_modules
# - /app/node_modules

api:
build: ./server
Expand All @@ -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
1 change: 0 additions & 1 deletion server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web-client/Dockerfile
Expand Up @@ -7,4 +7,4 @@ RUN npm install

COPY . ./

CMD npm start
CMD npm run start
14 changes: 11 additions & 3 deletions web-client/src/index.js
Expand Up @@ -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(
<React.StrictMode>
<BrowserRouter>
<App/>
</BrowserRouter>
<ApolloProvider client={client}>
<BrowserRouter>
<App/>
</BrowserRouter>
</ApolloProvider>
</React.StrictMode>,
document.getElementById('root')
);
Expand Down
30 changes: 17 additions & 13 deletions 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 (
<div className="dashboard-container">
{console.log(data)}
Hello Home! <button onClick={onClickSubmit}>Test</button>
</div>
);
Expand Down

0 comments on commit 56f4bf9

Please sign in to comment.