From a45f8cff080cf11ba239cfa35a4eb5eb91f05fe0 Mon Sep 17 00:00:00 2001 From: ac-rupesh <157466136+ac-rupesh@users.noreply.github.com> Date: Sun, 18 May 2025 09:55:51 +0530 Subject: [PATCH 1/8] create new api v2.py --- http/app.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/http/app.py b/http/app.py index 3e7924b3..f975b2f4 100644 --- a/http/app.py +++ b/http/app.py @@ -39,6 +39,22 @@ def hello(): return response +@app.route('/') +@app.route('/hello/v2') +def hello(): + name = request.args.get('name') + if name is None: + name = request.cookies.get('name', 'Human') + response = '

this is v2, Hello, %s!

' % escape(name) # escape name to avoid XSS + # return different response according to the user's authentication status + if 'logged_in' in session: + response += '[Authenticated]' + else: + response += '[Not Authenticated]' + return response + + + # redirect @app.route('/hi') def hi(): From dac3268bff323d5703fa4d6faa2d56b6ade704a4 Mon Sep 17 00:00:00 2001 From: ac-rupesh <157466136+ac-rupesh@users.noreply.github.com> Date: Sun, 18 May 2025 10:26:23 +0530 Subject: [PATCH 2/8] Update app.py --- http/app.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/http/app.py b/http/app.py index f975b2f4..402252b7 100644 --- a/http/app.py +++ b/http/app.py @@ -39,21 +39,6 @@ def hello(): return response -@app.route('/') -@app.route('/hello/v2') -def hello(): - name = request.args.get('name') - if name is None: - name = request.cookies.get('name', 'Human') - response = '

this is v2, Hello, %s!

' % escape(name) # escape name to avoid XSS - # return different response according to the user's authentication status - if 'logged_in' in session: - response += '[Authenticated]' - else: - response += '[Not Authenticated]' - return response - - # redirect @app.route('/hi') From c9932a632255e3fd03b27b0e2c266573a5bf59f6 Mon Sep 17 00:00:00 2001 From: ac-rupesh <157466136+ac-rupesh@users.noreply.github.com> Date: Thu, 22 May 2025 14:18:34 +0530 Subject: [PATCH 3/8] Update README.md --- README.md | 79 +------------------------------------------------------ 1 file changed, 1 insertion(+), 78 deletions(-) diff --git a/README.md b/README.md index 649a8205..3eb44029 100644 --- a/README.md +++ b/README.md @@ -1,78 +1 @@ -# Flask Examples - -Example applications for Flask beginners. - -## Installation - -First, you need to clone this repository: - -```bash -git clone git@github.com:greyli/flask-examples.git -``` - -Or: - -```bash -git clone https://github.com/helloflask/flask-examples.git -``` - -Then change into the `flask-examples` folder: - -```bash -cd flask-examples -``` - -Now, we will need to create a virtual environment and install all the dependencies: - -```bash -python3 -m venv venv # on Windows, use "python -m venv venv" instead -. venv/bin/activate # on Windows, use "venv\Scripts\activate" instead -pip install -r requirements.txt -``` - -## How to Run a Specific Example Application? - -**Before run a specific example application, make sure you have activated the virtual enviroment.** - -For example, if you want to run the Hello application, just execute these commands: - -```bash -cd hello -flask run -``` - -Similarly, you can run HTTP application like this: - -```bash -cd http -flask run -``` - -The applications will always running on http://localhost:5000. - -## Example Applications Menu - -- Hello (`/hello`): Say hello with Flask. -- HTTP (`/http`): HTTP handing in Flask. -- Templates (`/templates`): Templating with Flask and Jinja2. -- Form (`/form`): Form handing with Flask-WTF (WTForms), File upload and integrating with Flask-CKEditor, Flask-Dropzone. -- Database (`/database`): Database with Flask-SQLAlchemy (SQLAlchemy). -- Email (`/email`): Email with Flask-Mail, SendGrid -- Assets (`/assets`): Assets profiling with Flask-Assets. -- Cache (`/cache`): Cache with Flask-Caching. - -## Advanced Examples Flask Applications - -- [SayHello](https://github.com/greyli/sayhello): A simple message board. -- [Bluelog](https://github.com/greyli/bluelog): A blog engine that supports category and resource management. -- [Albumy](https://github.com/greyli/albumy): A full-featured photo-sharing social networking. -- [Todoism](https://github.com/greyli/todoism): A to-do application implements as SPA, it supports i18n and provides web APIs. -- [CatChat](https://github.com/greyli/catchat): A chat room based on WebSocket. - -## Contributions - -Any contribution is welcome, just fork and submit your PR. - -## License - -This project is licensed under the MIT License (see the `LICENSE` file for details). +#22/05/25 -> qa-test-1 From b2c68c541bbe3eca457e93c40828bee215191d09 Mon Sep 17 00:00:00 2001 From: ac-rupesh <157466136+ac-rupesh@users.noreply.github.com> Date: Thu, 22 May 2025 15:15:09 +0530 Subject: [PATCH 4/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3eb44029..095a8a45 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ #22/05/25 -> qa-test-1 +#22/05/25 -> manual change concurrency map to not include installationId From 821f90dbaeb931879c26a3a9dd596805edb0de43 Mon Sep 17 00:00:00 2001 From: ac-rupesh <157466136+ac-rupesh@users.noreply.github.com> Date: Fri, 23 May 2025 15:46:01 +0530 Subject: [PATCH 5/8] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 095a8a45..5401f139 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -#22/05/25 -> qa-test-1 -#22/05/25 -> manual change concurrency map to not include installationId +# 22/05/25 -> qa-test-1 +# 22/05/25 -> manual change concurrency map to not include installationId +# 23/05/25 -> qa test From d4b63a22e11a808ee10197923ebb014c49214a17 Mon Sep 17 00:00:00 2001 From: ac-rupesh <157466136+ac-rupesh@users.noreply.github.com> Date: Fri, 23 May 2025 16:04:22 +0530 Subject: [PATCH 6/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 095a8a45..65980816 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -#22/05/25 -> qa-test-1 +#22/05/25 -> qa-test-1 #22/05/25 -> manual change concurrency map to not include installationId From c9f2b98d6cf7a9fece337c46e0257a0f4333e341 Mon Sep 17 00:00:00 2001 From: ac-rupesh <157466136+ac-rupesh@users.noreply.github.com> Date: Sat, 24 May 2025 09:47:51 +0530 Subject: [PATCH 7/8] Update app.py --- http/app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/http/app.py b/http/app.py index 402252b7..52dae5fa 100644 --- a/http/app.py +++ b/http/app.py @@ -45,7 +45,10 @@ def hello(): def hi(): return redirect(url_for('hello')) - +@app.route('/hi2') +def hi(): + return redirect(url_for('hello')) + # use int URL converter @app.route('/goback/') def go_back(year): From e78d6fe1a745df82ca8a74ff5be321b7321a6583 Mon Sep 17 00:00:00 2001 From: "sumit.kumar" Date: Mon, 26 May 2025 16:57:33 +0530 Subject: [PATCH 8/8] Added a medical report api --- MedicalReport.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 MedicalReport.rs diff --git a/MedicalReport.rs b/MedicalReport.rs new file mode 100644 index 00000000..45270545 --- /dev/null +++ b/MedicalReport.rs @@ -0,0 +1,35 @@ +use actix_web::{web, App, HttpResponse, HttpServer, Responder}; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize)] +struct MedicalReport { + patient_id: String, + name: String, + age: u8, + diagnosis: String, + treatment: String, +} + +async fn get_report(patient_id: web::Path) -> impl Responder { + let report = MedicalReport { + patient_id: patient_id.into_inner(), + name: "John Doe".to_string(), + age: 35, + diagnosis: "Common Cold".to_string(), + treatment: "Rest and fluids".to_string(), + }; + HttpResponse::Ok().json(report) +} + +#[actix_web::main] +async fn main() -> std::io::Result<()> { + HttpServer::new(|| { + App::new().service( + web::resource("/report/{patient_id}") + .route(web::get().to(get_report)) + ) + }) + .bind("127.0.0.1:8080")? + .run() + .await +} \ No newline at end of file