from flask import Flask, jsonify, request app = Flask(__name__) # "customers" customers_data = [] @app.route('/service_a/', methods=['GET']) def get_index(): return "Hello from service_a" @app.route('/service_a/customers', methods=['GET']) def get_customers(): return jsonify(customers_data) @app.route('/service_a/customers', methods=['POST']) def create_customer(): new_customer = request.json customers_data.append(new_customer) return jsonify(new_customer), 201 @app.route('/service_a/customers/', methods=['PUT']) def update_customer(id): for customer in customers_data: if customer['id'] == id: customer.update(request.json) return jsonify(customer), 200 return jsonify({'error': 'Customer not found'}), 404 @app.route('/service_a/customers/', methods=['DELETE']) def delete_customer(id): global customers_data customers_data = [customer for customer in customers_data if customer['id'] != id] return jsonify({'message': 'Customer deleted'}), 200 if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)