Skip to content
Snippets Groups Projects
Commit 48cf7761 authored by Jacopo Gasparetto's avatar Jacopo Gasparetto
Browse files

First commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 332 additions and 0 deletions
.vscode/
.DS_Store
FROM python:3.11-slim-bullseye
ARG USERNAME="backend"
RUN apt-get update && apt-get install curl -y && \
apt-get clean && \
rm -rf /var/apt/cache && \
pip install --upgrade pip && \
useradd -m ${USERNAME}
USER ${USERNAME}
WORKDIR /app
COPY --chown=${USERNAME}:${USERNAME} src/ /app
COPY --chown=${USERNAME}:${USERNAME} requirements.txt .
ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"
RUN pip install -r requirements.txt && \
pip cache purge && \
rm requirements.txt
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--reload", "--reload-dir", "/app"]
\ No newline at end of file
anyio==3.6.2
click==8.1.3
fastapi==0.95.0
h11==0.14.0
httptools==0.5.0
idna==3.4
pydantic==1.10.7
python-dotenv==1.0.0
PyYAML==6.0
sniffio==1.3.0
starlette==0.26.1
typing_extensions==4.5.0
uvicorn==0.21.1
uvloop==0.17.0
watchfiles==0.19.0
websockets==11.0
from typing import Union
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Union[str, None] = None):
return {"item_id": item_id, "q": q}
\ No newline at end of file
version: '3'
services:
frontend:
container_name: frontend
image: frontend
build:
context: frontend
volumes:
- ./frontend/:/app/
- node_modules:/app/node_modules
environment:
- WATCHPACK_POLLING=true # Enable react dev server auto-reload
backend:
container_name: backend
image: backend
build:
context: backend
volumes:
- ./backend/src/:/app/
environment:
- WATCHFILES_FORCE_POLLING=true # Enable uvicorn auto-reload
nginx:
image: nginx:latest
container_name: nginx
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
ports:
- 8080:80
volumes:
node_modules:
# https://stackoverflow.com/questions/70585472/websocketclient-js16-websocket-connection-to-ws-localhost3000-ws-failed-r
WDS_SOCKET_PORT=0
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
FROM node:19-slim
COPY . /app
WORKDIR /app
RUN npm install && npm cache clean --force
CMD ["npm", "run", "start"]
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
Source diff could not be displayed: it is too large. Options to address this: view the blob.
{
"name": "frontend-s3",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.21",
"@types/react": "^18.0.29",
"@types/react-dom": "^18.0.11",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.9.0",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"tailwindcss": "^3.2.7"
}
}
frontend/public/favicon.ico

3.78 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
frontend/public/logo192.png

5.22 KiB

frontend/public/logo512.png

9.44 KiB

frontend/public/logo530.png

15.8 KiB

{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo530.png",
"type": "image/png",
"sizes": "530x268"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
import React from "react";
import { routes } from './routes';
import { Drawer } from './components/Drawer';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
const router = createBrowserRouter(routes.map(el => el.route));
function App() {
return (
<div className="flex mb-4">
<Drawer />
<RouterProvider router={router} />
</div>
)
}
export default App;
\ No newline at end of file
import React from 'react';
import { routes } from '../routes';
export const Drawer = () => {
const items = routes.map(el => {
return (
<li key={el.route.path}>
<a href={el.route.path}>{el.title}</a>
</li>
);
})
return (
<div id="sidebar" className="top-0 left-0 w-64 overflow-y-auto">
<img className="w-full bg-gray-100 p-4" alt="" src="/logo530.png" style={{ mixBlendMode: "multiply" }} />
<nav className="h-screen">
<div className="h-full p-4 overflow-y-auto bg-gray-100 dark:bg-gray-800">
<ul>
{items}
</ul>
</div>
</nav>
</div>
)
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment