Skip to content

Commit b3afaf1

Browse files
committed
feat: Implementing App in Src
1 parent c479873 commit b3afaf1

File tree

13 files changed

+43
-7
lines changed

13 files changed

+43
-7
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.exclude": {
3+
"**/__pycache__": true
4+
}
5+
}

123-456-789.png

-5.9 KB
Binary file not shown.

README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131
<details>
3232

3333
<summary>⏰Day-1</summary>
34-
- Adding Pylint to project
35-
- Adding pre-commit to project
36-
- Adding server base params, including route and feature for generating barcode
37-
- Adding and update the requirements
38-
- Adding README.md and LICENSE
34+
- Adding Pylint to project <br>
35+
- Adding pre-commit to project <br>
36+
- Adding server base params, including route and feature for generating barcode <br>
37+
- Adding and update the requirements <br>
38+
- Adding README.md and LICENSE <br><br>
39+
40+
---
3941

4042
**Pylint and naming conventions**:
4143
```py
@@ -62,6 +64,18 @@ When we want to keep a record of installed dependencies and their versions, we u
6264

6365
<summary>⏰Day-2</summary>
6466

67+
**__init__.py**:
68+
```
69+
This file is responsible for allow imports inside the folders. All folders that needs imports in their functions must have one of this file. Even if the folders were in cascating, each folder must have a file __init__.py .
70+
```
71+
72+
```
73+
As responsabilidades principais da aplicação foram melhor distribuidas, ou melhor organizadas. Por exemplo, a pasta main concentrou a responsabilidade pelo framework, de modo que qualquer alteração que queira realizar no framework é lá, e apenas lá que terei que fazer alterções.
74+
```
75+
```
76+
As Blueprints facilitam na rápida identificação do papel de cada rota da aplicação, contruibuindo também para a melhor organização e legebilidade do código. É uma bibioteca muito útil dentro do framework Flask.
77+
```
78+
6579
</details>
6680

6781
<details>

Raphael-GC.png

-5.1 KB
Binary file not shown.

feature.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

run.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from src.main.server.server import app
2+
3+
if __name__ == "__main__":
4+
app.run(host='0.0.0.0', port=3000, debug=True)

run_raw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
app = Flask(__name__)
66

7-
@app.route('/create_tag', methods=["POST"])
7+
@app.route('/create_tag', methods=["POST"]) # Propriedeade, também chamado como decorador.
88
def create_tag():
99
body = request.json
1010
product_code = body.get('product_code')

src/__init__.py

Whitespace-only changes.

src/main/__init__.py

Whitespace-only changes.

src/main/routes/__init__.py

Whitespace-only changes.

src/main/routes/tag_routes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from flask import Blueprint, request, jsonify
2+
3+
tags_routes_bp = Blueprint('tags_routes', __name__)
4+
5+
@tags_routes_bp.route('/create_tag', methods=["POST"])
6+
def create_tags():
7+
print(request.json)
8+
return jsonify({ "resp": "ok" }), 200

src/main/server/__init__.py

Whitespace-only changes.

src/main/server/server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from flask import Flask
2+
from src.main.routes.tag_routes import tags_routes_bp
3+
4+
app = Flask(__name__)
5+
6+
app.register_blueprint(tags_routes_bp)

0 commit comments

Comments
 (0)