mirror of
https://github.com/ivanch/tcc.git
synced 2025-08-25 07:11:50 +00:00
adding nginx page & simulation endpoint
This commit is contained in:
@@ -11,11 +11,13 @@ RUN apt-get update && apt-get install -y imagemagick && apt-get install -y wget
|
||||
RUN wget https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png && \
|
||||
wget https://files.ivanch.me/api/public/dl/81Bkht5C/big-image.png && \
|
||||
wget https://files.ivanch.me/api/public/dl/nAndfAjK/video.mp4 && \
|
||||
wget https://files.ivanch.me/api/public/dl/RzXwJG7o/nginx.html && \
|
||||
rm -rf runtimes && \
|
||||
mkdir -p ./static && \
|
||||
mv small-image.png ./static && \
|
||||
mv big-image.png ./static && \
|
||||
mv video.mp4 ./static
|
||||
mv video.mp4 ./static && \
|
||||
mv nginx.html ./static
|
||||
|
||||
COPY . .
|
||||
|
||||
|
@@ -1,11 +1,13 @@
|
||||
from flask import Flask
|
||||
from controllers.status import status_blueprint
|
||||
from controllers.simulation import simulation_blueprint
|
||||
from controllers.image import image_blueprint
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
#
|
||||
app.register_blueprint(status_blueprint)
|
||||
app.register_blueprint(simulation_blueprint)
|
||||
app.register_blueprint(image_blueprint)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
23
FlaskAPI/controllers/simulation.py
Normal file
23
FlaskAPI/controllers/simulation.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from flask import request, Blueprint
|
||||
|
||||
simulation_blueprint = Blueprint('simulation_blueprint', __name__)
|
||||
|
||||
class SimulationController:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def harmonic_progression(self, n):
|
||||
sum = 0
|
||||
for i in range(1, n):
|
||||
sum += 1/i
|
||||
|
||||
return sum
|
||||
|
||||
simulation_controller = SimulationController()
|
||||
|
||||
@simulation_blueprint.route('/simulation/harmonic-progression', methods=['GET'])
|
||||
def return_ok():
|
||||
n = int(request.args.get('n'))
|
||||
sum = simulation_controller.harmonic_progression(n)
|
||||
|
||||
return str(sum), 200
|
Reference in New Issue
Block a user