{"id":25019639,"url":"https://github.com/djeada/flask-minimal","last_synced_at":"2025-04-28T14:03:10.860Z","repository":{"id":50526519,"uuid":"358993734","full_name":"djeada/Flask-Minimal","owner":"djeada","description":"The purpose of this template is to provide a starting point for creating new Flask apps that require more than the bare minimum. The README provides instructions for installation on Unix/MacOS as well as using Docker. Additionally, it explains how to generate documentation using Sphinx. ","archived":false,"fork":false,"pushed_at":"2024-12-31T11:33:56.000Z","size":131,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T10:11:37.992Z","etag":null,"topics":["flask-application","tutorial-demos","webapp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djeada.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-17T22:18:46.000Z","updated_at":"2024-12-31T11:33:53.000Z","dependencies_parsed_at":"2024-05-28T14:58:36.397Z","dependency_job_id":"dcf96c14-53be-4d05-bf2d-86d50e27758e","html_url":"https://github.com/djeada/Flask-Minimal","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FFlask-Minimal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FFlask-Minimal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FFlask-Minimal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FFlask-Minimal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djeada","download_url":"https://codeload.github.com/djeada/Flask-Minimal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251326794,"owners_count":21571632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask-application","tutorial-demos","webapp"],"created_at":"2025-02-05T11:51:18.202Z","updated_at":"2025-04-28T14:03:10.789Z","avatar_url":"https://github.com/djeada.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask-Minimal\n\nThe purpose of this template is to provide a starting point for creating new Flask apps that require more than the bare minimum. The README provides instructions for installation on Unix/MacOS as well as using Docker. Additionally, it explains how to generate documentation using Sphinx. \n\n## Problem description\n\nWhen creating a new Flask app, it is often useful to have a template that can be used to start from. \n\nThe bare minmal Flask app consits of only a few lines of code:\n\n ```Python\nfrom flask import Flask\napp = Flask(name)\n@app.route(\"/\")\ndef main():\n    return \"Hello World\"\n```  \n\nWe usually want a bit more than that. That's why I decided to create this template.\n\n# Installation\n\n## Setup for Unix, MacOS\n\n1. Download the code repository from GitHub:\n    \n```Bash\ngit clone https://github.com/djeada/Flask-Minimal.git\ncd Flask-Minimal\n```\n\n2. Install dependencies in a virtual environment:\n\n```Bash\npython -m venv env\nsource env/bin/activate\npip install -r requirements.txt\n```\n\n3. Start the app:\n\n```Bash\npython src/app.py\n```\n\nTo make the server available on the LAN, modify the code where the run method is called on the Flask instance (here named app):\n\n```Python\napp.run(host='0.0.0.0')\n```\n\n##  Start the app in Docker\n\n1. Download the code from the repository:\n    \n```Bash\ngit clone https://github.com/djeada/Flask-Minimal.git\ncd Flask-Minimal\n```\n\n2. Build the Docker image:\n    \n```Bash\ndocker build -t minimal-flask-app .\n```\n\n3. Start a Docker container:\n\n```Bash\nsudo docker run --network=host minimal-flask-app\n```\n\n4. In your browser, go to `http://localhost:5000`. The app should now be working.\n\n# API\n\n## Endpoints\n\n### GET /books\nThis endpoint returns a list of all books in the library.\n\nTo get a list of all books in the library, you can use the following curl command:\n\n```Bash\ncurl http://localhost:5000/books\n```\n\nTo get a list of all books in the library using JavaScript, you can use the fetch function as follows:\n\n```javascript\nfetch('http://localhost:5000/books')\n  .then(response =\u003e response.json())\n  .then(data =\u003e console.log(data));\n```\n\n### GET /books/\u003cint:book_id\u003e\nThis endpoint returns information about a specific book, specified by its ID.\n\nTo get information about a specific book, you can use the following curl command:\n\n```Bash\ncurl http://localhost:5000/books/1\n```\n\nTo get information about a specific book using JavaScript, you can use the fetch function as follows:\n\n```javascript\nfetch('http://localhost:5000/books/1')\n  .then(response =\u003e response.json())\n  .then(data =\u003e console.log(data));\n```\n\n### POST /books\nThis endpoint allows users to add a new book to the library. Users should submit a JSON object containing the book's title, author, and description.\n\nTo add a new book to the library, you can use the following curl command:\n\n```Bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"title\":\"New Book\", \"author\":\"Author Name\", \"description\":\"Book Description\"}' http://localhost:5000/books\n```\n\nTo add a new book to the library using JavaScript, you can use the fetch function with the POST method as follows:\n\n```javascript\nfetch('http://127.0.0.1:5000/books', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify( {\n            \"id\": 7,\n            \"title\": \"The Return of the King\",\n            \"author\": \"J.R.R. Tolkien\",\n            \"year\": 1955,\n        })\n})\n.then(response =\u003e response.json())\n.then(data =\u003e console.log(data))\n```\n\n### DELETE /books/\u003cint:book_id\u003e\nThis endpoint allows users to delete a book from the library, specified by its ID.\n\nTo delete a book from the library, you can use the following curl command:\n\n```Bash\ncurl -X DELETE http://localhost:5000/books/1\n```\n\nTo delete a book from the library using JavaScript, you can use the fetch function with the DELETE method as follows:\n\n```javascript\nfetch('http://localhost:5000/books/1', {\n  method: 'DELETE'\n})\n  .then(response =\u003e response.json())\n  .then(data =\u003e console.log(data));\n```\n\n# Documentation\n\nSphinx is a tool that can be used to automatically generate documentation from your project's docstrings. This template includes a basic documentation setup using Sphinx.\n\n## Creating documentation\n\nIf documentation has not yet been created for your project, you can create a basic Sphinx documentation setup using the following steps:\n\n```Bash\nmkdir -p docs \u0026\u0026 cd docs\nsphinx-quickstart\nsphinx-apidoc -o . ..\nmake html\n```\n\n## Modifying documentation\n\nTo modify the documentation for this template, you can make changes to the existing `docs/source` directory.\n\n* Configuration\n\nThe Sphinx configuration file is located at `docs/source/conf.py`. You can modify this file to change various settings such as the project name, author, and more.\n\n* Content\n\nThe main content for the documentation is located in `docs/source/index.rst`. You can modify this file to add or remove sections and pages as needed.\n\n* Updating and viewing documentation\n\nTo update the documentation after making changes, run the following command from the `docs` directory:\n\n```Bash\nmake html\n```\n\nTo view the generated HTML documentation, open `docs/build/html/index.html` in a web browser.\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\nThis project is licensed under the terms of the MIT license. See the [LICENSE](https://choosealicense.com/licenses/mit/) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjeada%2Fflask-minimal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjeada%2Fflask-minimal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjeada%2Fflask-minimal/lists"}