{"id":15700176,"url":"https://github.com/arig23498/flutter_workshop","last_synced_at":"2025-05-12T13:12:55.909Z","repository":{"id":112411887,"uuid":"208296952","full_name":"ariG23498/Flutter_Workshop","owner":"ariG23498","description":"This is the RESTful API for the workshop","archived":false,"fork":false,"pushed_at":"2019-09-14T13:01:14.000Z","size":151,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-12T13:12:39.579Z","etag":null,"topics":["flask","python","rest-api"],"latest_commit_sha":null,"homepage":"https://flutter-workshop.herokuapp.com/","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ariG23498.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-09-13T15:49:02.000Z","updated_at":"2022-03-30T08:06:27.000Z","dependencies_parsed_at":"2023-05-14T18:15:43.155Z","dependency_job_id":null,"html_url":"https://github.com/ariG23498/Flutter_Workshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariG23498%2FFlutter_Workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariG23498%2FFlutter_Workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariG23498%2FFlutter_Workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariG23498%2FFlutter_Workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ariG23498","download_url":"https://codeload.github.com/ariG23498/Flutter_Workshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745195,"owners_count":21957319,"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","python","rest-api"],"created_at":"2024-10-03T19:46:39.504Z","updated_at":"2025-05-12T13:12:55.852Z","avatar_url":"https://github.com/ariG23498.png","language":"Dart","readme":"## Ways to get about it\n\nThe following ways are specially curated with the help of an API guy (used him to get rid of him :speak_no_evil:)\n\n*  Create a Folder which will hold all of you `Flask` app configurations and the app itself.\n* **Prerequisites**: `pip install virtualenv`\n* Create a virtual environment `python3 -m venv \u003cfolder name\u003e` This creates a `\u003cfolder name\u003e` folder inside the directory we are in.\n* Activate the environment \n  * **Linux**: `source \u003cfolder name\u003e/bin/activate`\n  * **Windows**: `\u003cfolder name\u003e\\Scripts\\activate.bat` \n\n\u003cimg src=\"Assets/virtual.png\"\u003e\n\n* **Requirements**: We need to install `Flask` and `gunicorn` for the following steps\n  * `pip install Flask`\n  * `pip install gunicorn`\n* We need to make two files named `Procfile` and `requirements.txt`\n* Now come the `app.py`\n\n## A Basic Flask Application:\n\n```python\nfrom flask import Flask,jsonify,make_response,request\nimport json\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef home():\n    return \"Hey there!\"\n\nif __name__ == \"__main__\":\n    app.run(host='0.0.0.0', debug=False, port=8000)\n```\n\n## The application Decoded (literally :jack_o_lantern: )\n\n### Get the data\n\n```python\n@app.route(\"/getData/\")\ndef getdata():\n    # Read the data from the json file\n    with open(\"data.json\", \"r\") as read_file:\n        data = json.load(read_file)\n    # Return a response and the status code as 200 ^_^\n    return make_response(jsonify(data),200)\n```\n\n\n\n### Post the data from app and store it :grin:\n\n``` python\n@app.route(\"/setData/\",methods=[\"POST\"])\ndef setdata():\n    # Read the data from the json file\n    # The file is a list of dictionaries\n    with open(\"data.json\", \"r\") as read_file:\n        data = json.load(read_file)\n    # Get the data that has been posted\n    # which is a dictionary\n    data_posted = request.get_json()\n    # append to the list the newly entered dictionary\n    data.append(data_posted)\n    # Open the file in write mode\n    # And dump the data\n    with open(\"data.json\", \"w\") as write_file:\n        json.dump(data,write_file)\n    # Return a happy status ^_^\n    return make_response(jsonify({\"success\":True}),200)\n```\n\n\n\n## Procfile:\n\n```\nweb: gunicorn -w 17 -b :$PORT app:app\n```\n\n\n\n## requirements.txt:\n\n```\nFlask\ngunicorn\n```\n\n:confetti_ball: **A RESTful API has been made**\n\n\n\n## Let us check with the endpoints, shall we?\n\n\u003cimg src=\"Assets/post.png\"\u003e\n\n\n\n## Test and then Deploy\n\n* make the folder a git repository `git init`\n* create a `Github` repository of your own and push the folder to the repository\n* create a `Heroku` account and deploy the repository and voila. ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farig23498%2Fflutter_workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farig23498%2Fflutter_workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farig23498%2Fflutter_workshop/lists"}