Skip to content

Commit

Permalink
App init
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalik2 committed Apr 1, 2024
1 parent 33a4b48 commit 6263a17
Show file tree
Hide file tree
Showing 35 changed files with 2,003 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
node_modules
/.pnp
.pnp.js

Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build:
docker-compose up -d --build

up:
docker-compose up -d

down:
docker-compose down -v

# windows MinGW32-make [command]
# linux make [command] (superior system)
6 changes: 6 additions & 0 deletions app/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
Dockerfile
.dockerignore
.git
.gitignore
README.md
9 changes: 9 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:15
WORKDIR /app
COPY package.json .
RUN npm install && npm install typescript -g
COPY . .
ENV PORT 3000
EXPOSE ${PORT}
RUN tsc
CMD [ "npm", "start" ]
108 changes: 75 additions & 33 deletions package-lock.json → app/package-lock.json

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

11 changes: 8 additions & 3 deletions package.json → app/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"name": "frontend",
"name": "front",
"version": "0.1.0",
"proxy": "http://host.docker.internal:5000",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.91",
"@types/react": "^18.2.72",
"@types/react-dom": "^18.2.22",
"@types/react": "^18.2.73",
"@types/react-dom": "^18.2.23",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
Expand Down Expand Up @@ -39,5 +41,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"tailwindcss": "^3.4.3"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions src/App.css → app/src/App.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

.App {
text-align: center;
}
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { BrowserRouter, Route, Routes } from "react-router-dom"
import Home from './pages/home';

function App() {

return (
<BrowserRouter>
<Routes>
<Route path='/' element={ <Home/> }></Route>
</Routes>
</BrowserRouter>

);
}

export default App;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/index.tsx → app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const root = ReactDOM.createRoot(
);
root.render(
<React.StrictMode>
<App />
<App />
</React.StrictMode>
);

Expand Down
File renamed without changes
43 changes: 43 additions & 0 deletions app/src/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React, {useEffect, useState} from 'react';
import logo from '../logo.svg';
import '../App.css';

export default function Home(){
const [backendData, setBackendData] = useState([{}])

useEffect(()=> {
fetch("/api").then(
response => response.json()
).then(
data => {
setBackendData(data);
}
)
}, [])

console.log(backendData);

return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<h1 className="text-3xl font-bold underline">
Test tailwinda
</h1>

<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}

File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions app/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}

File renamed without changes.
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.8'
services:
backend-container:
build: ./server
ports:
- "5000:5000"
volumes:
- ./server:/app:ro
- /app/node_modules
env_file:
- ./server/.env
frontend-container:
build: ./app
depends_on:
- backend-container
ports:
- "3000:3000"
volumes:
- ./app:/app
Loading

0 comments on commit 6263a17

Please sign in to comment.