Update flask_container_ci challenge

This commit is contained in:
abregman 2019-12-22 11:30:09 +02:00
parent f2cc9773f8
commit 634143172c
3 changed files with 15 additions and 9 deletions

View File

@ -11,6 +11,7 @@ Please read carefully all the instructions.
If any of the following steps is not working, it is expected from you to fix them If any of the following steps is not working, it is expected from you to fix them
1. Move to `challenges/flask_container_ci` directory, if you are not already there
1. Run `export FLASK_APP=app/app.py` 1. Run `export FLASK_APP=app/app.py`
1. To run the app execute `flask run`. If it doesn't works, fix it 1. To run the app execute `flask run`. If it doesn't works, fix it
3. Access `http://127.0.0.1:5000`. You should see the following 3. Access `http://127.0.0.1:5000`. You should see the following
@ -27,8 +28,10 @@ If any of the following steps is not working, it is expected from you to fix the
4. You should be able to access any of the resources and get the following data: 4. You should be able to access any of the resources and get the following data:
* /users/<username> - data on the specific chosen user
* /users - all users data * /users - all users data
* /users/<username> - data on the specific chosen user
5. When accessing /users, the data returned should not include the id of the user, only its name and description. Also, the data should be ordered by users names.
## Containers ## Containers
@ -40,7 +43,7 @@ docker run -d -p 5000:5000 app
``` ```
1. You can use any image base you would like 1. You can use any image base you would like
2. Containrize only what you need for running the application, nothing else. 2. Containerize only what you need for running the application, nothing else.
## CI ## CI

View File

@ -4,9 +4,8 @@
from flask import Flask from flask import Flask
from flask import make_response from flask import make_response
from werkzeug.exceptions import NotFound
import json import json
from werkzeug.exceptions import NotFound
app = Flask(__name__) app = Flask(__name__)
@ -15,7 +14,7 @@ with open("./users.json", "r") as f:
users = json.load(f) users = json.load(f)
@app.route("/", methods=['GET']) @app.routee("/", methods=['GET'])
def index(): def index():
return pretty_json({ return pretty_json({
"resources": { "resources": {

View File

@ -1,18 +1,22 @@
{ {
"geralt" : { "geralt" : {
"id": "whitewolf", "id": "whitewolf",
"name": "Geralt of Rivia" "name": "Geralt of Rivia",
"description": "Traveling monster slayer for hire"
}, },
"lara_croft" : { "lara_croft" : {
"id": "m31a3n6sion", "id": "m31a3n6sion",
"name": "Lara Croft" "name": "Lara Croft",
"description": "Highly intelligent and athletic English archaeologist"
}, },
"mario" : { "mario" : {
"id": "smb3igiul", "id": "smb3igiul",
"name": "Mario" "name": "Mario",
"description": "Italian plumber who really likes mushrooms"
}, },
"gordon_freeman" : { "gordon_freeman" : {
"id": "nohalflife3", "id": "nohalflife3",
"name": "Gordon Freeman" "name": "Gordon Freeman",
"description": "Physicist with great shooting skills"
} }
} }