rewrite in game-server-new.py

This commit is contained in:
Nico Schottelius 2019-05-12 00:18:03 +02:00
parent cb17e8adae
commit 5d408d4a14
3 changed files with 61 additions and 2 deletions

View File

@ -1,3 +1,7 @@
## Notes to myself
* Notes in ungleich-marketing.org / Quiz
## Objective
This codebase is for preparing the ungleich game, which heavily relies
@ -21,6 +25,8 @@ our new monitoring system that does not suck.
- Define points (or monitoring severity)
## How to play
### Monitoring
@ -41,7 +47,12 @@ ungleich play-game --game dns-forward --ip
## Documentation
- Rais CheckException on parameter wrong
- Raise CheckException on parameter wrong
## How to write a check
- Your command must return with exit code = 0
- Output will be saved by cmon, but not interpreted
## TODOs

24
game-server-new.py Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class Game(Resource):
def get(self):
return {'hello': 'world'}
api.add_resource(Game, '/game')
@app.route("/")
def high_score():
return "High score!"
if __name__ == '__main__':
app.run(port='5002')

View File

@ -29,9 +29,33 @@ class Employees_Name(Resource):
return jsonify(result)
@app.route("/")
def hello():
return """
<pre>
Join the game
- Create an on account.ungleich.ch
-> creates ldap account
Creating the game:
- Create IPv6 only VM + http proxy
- Intro on main page
- Score list below
- Users can be clicked
</pre>
"""
api.add_resource(Employees, '/employees') # Route_1
api.add_resource(Tracks, '/tracks') # Route_2
api.add_resource(Employees_Name, '/employees/<employee_id>') # Route_3
#api.add_resource(Tracks, '/tracks') # Route_2
if __name__ == '__main__':