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.

47 lines
1.9 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. from flask import Flask, send_from_directory
  2. from flask_restful import Api
  3. from modules import user_info, voting_system, rating_system, denunciation, navigation, bus_stops, announcements, complaint
  4. from modules import utility
  5. app = Flask(__name__)
  6. api = Api(app)
  7. @app.route('/img/<path:path>')
  8. def send_img(path):
  9. return send_from_directory('images', path)
  10. if __name__ == '__main__':
  11. context = ('encryption/mycity.crt', 'encryption/mycity-decrypted.key')
  12. api.add_resource(voting_system.Votings, '/votings', '/votings/')
  13. api.add_resource(voting_system.Voting, '/votings/<int:voting_id>')
  14. api.add_resource(voting_system.Vote, '/vote', '/vote/')
  15. api.add_resource(rating_system.Ratings, '/ratings', '/ratings/')
  16. api.add_resource(rating_system.Rating, '/ratings/<int:rating_id>', '/ratings/<int:rating_id>/')
  17. api.add_resource(rating_system.Rate, '/rate', '/rate/')
  18. api.add_resource(user_info.Users, '/users', '/users/')
  19. api.add_resource(user_info.User, '/users/<path:user_id>', '/users/<path:user_id>/')
  20. api.add_resource(user_info.Login, '/login', '/login/')
  21. api.add_resource(user_info.ReducePoints, '/reduce', '/reduce/')
  22. api.add_resource(utility.Resources, '/resources', '/resources/')
  23. api.add_resource(denunciation.Alert, '/denunciation', '/denunciation/')
  24. api.add_resource(denunciation.Denunciations, '/denunciations', '/denunciations/')
  25. api.add_resource(navigation.Transit, '/transit', '/transit/')
  26. api.add_resource(bus_stops.Bus, '/bus', '/bus/')
  27. api.add_resource(announcements.Announcement, '/announcements', '/announcements/')
  28. #api.add_resource(smart_park.Empty, '/parking', '/parking/')
  29. api.add_resource(complaint.Complaint,"/complaint","/complaint/")
  30. api.add_resource(complaint.Complaints,"/complaints","/complaints/")
  31. api.add_resource(complaint.ComplaintsAdmin,"/complaints_admin","/complaints_admin/")
  32. app.run(host='0.0.0.0', port=5000, ssl_context=context)