Skip to content

A simple Flask application mostly generated with help of GitHub Copilot plugin as part of internal GenAI training course.

Notifications You must be signed in to change notification settings

pwyp/ExampleFlaskProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExampleFlaskProject

This is a simple Flask application that provides two routes: a home route and a message analysis route.

REMARK: The vast majority of this project (directory structure, contents of files, unit tests, the skeleton of this README.md) was generated using the GitHub Copilot and GitHub Copilot Chat plug-ins of Visual Studio Code.

Prerequisities

Installation

Create the environment:

> cd ExampleFlaskProject
> python -m venv .venv
> .venv\Scripts\activate.bat

Install the required packages using pip:

(env) pip install -r requirements.txt

Running the Application

To run the application, navigate to the app directory and run the following command:

> cd ExampleFlaskProject
> python .\app\routes.py

Usage

The application provides two routes:

  1. Home route (/): Returns a JSON response with a 'message' key set to 'Hello, World!'.
    > curl -X GET http://localhost:5000
    
  2. Message analysis route (/analyze_message): Analyzes the message received from the request and returns the word count.
    > curl -X POST -H "Content-Type: application/json" -d "{\"message\":\"Hello, World!\"}" http://localhost:5000/analyze_message
    

Running Tests

To run tests, navigate to the tests directory and run the one of the following commands:

> cd ExampleFlaskProject
> python -m unittest discover -v
> python -m unittest -v .\tests\test_routes.py

API Reference

Get home

GET /

Returns a JSON response with a 'message' key set to 'Hello, World!'.

Analyze message

POST /analyze_message

Analyzes the message received from the request and returns the word count.

Parameter Type Description
message string Required. Your message

License

MIT

About

A simple Flask application mostly generated with help of GitHub Copilot plugin as part of internal GenAI training course.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages