You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.1 KiB

6 years ago
  1. from flask import Flask, send_from_directory
  2. from flask_restful import Resource, Api
  3. from modules import voting_system, rating_system, user_info
  4. app = Flask(__name__)
  5. api = Api(app)
  6. @app.route('/img/<path:path>')
  7. def send_img(path):
  8. return send_from_directory('images', path)
  9. if __name__ == '__main__':
  10. context = ('encryption/mycity.crt','encryption/mycity-decrypted.key')
  11. api.add_resource(voting_system.Votings, '/votings', '/votings/')
  12. api.add_resource(voting_system.Voting, '/votings/<int:voting_id>')
  13. api.add_resource(voting_system.Vote, '/vote', '/vote/')
  14. api.add_resource(rating_system.Ratings, '/ratings', '/ratings/')
  15. api.add_resource(rating_system.Rating, '/ratings/<int:rating_id>', '/ratings/<int:rating_id>/')
  16. api.add_resource(rating_system.Rate, '/rate', '/rate/')
  17. api.add_resource(user_info.Users, '/users', '/users/')
  18. api.add_resource(user_info.User, '/users/<path:user_id>', '/users/<path:user_id>/')
  19. api.add_resource(user_info.Login, '/login', '/login/')
  20. app.run(host='0.0.0.0', port=5000, ssl_context=context)