我知道问这个问题有点荒唐,但是我可以避免使用诸如-/**
* @param {org.isn.shop.PlaceOrder}orderRequest
* @transaction
*/
async function placeOrder(orderRequest){
const factory = getFactory();
const customerRegistry = await getParticipantRegistry("org.isn.customer.Customer");
const customerExists = await customerRegistry.exists(orderRequest.customer.email);
if(!customerExists){
const customer = factory.newResource("org.isn.customer","Customer",orderRequest.customer.email);
customer.firstName = orderRequest.customer.firstName;
customer.lastName = orderRequest.customer.lastName;
customer.email = orderRequest.customer.email;
customer.password = orderRequest.customer.password;
await customerRegistry.add(customer);
}else{
const customer = await customerRegistry.get(orderRequest.customer.email);
}
const order = await factory.newResource("org.isn.shop","Order",orderRequest.orderId);
order.customer = customer.getIdentifier();
order.item = orderRequest.item;
const orderRegistry = await getAssetRegistry("org.isn.shop.Order");
await orderRegistry.add(order);
const PlaceOrderEvent = factory.newEvent("org.isn.shop","PlaceOrderEvent");
placeOrderEvent.order = order;
emit(placeOrderEvent);
}
,Flask
等之类的Web框架,并在Falcon
环境中运行最小的WSGI服务器。我正在尝试在一个资源紧张且资源紧张的严密环境中运行WSGI流程,例如Raspberry Pi。我将不需要处理很多客户端负载。客户数量最多为1或2。每秒不超过10个查询。所以想知道我是否可以自己编写一些Python代码来淘汰所有可能的组件。
我一直在搜索有关此内容的任何文档,但无法获取太多信息。欢迎在没有成熟框架的情况下为自定义python Web应用程序提供服务的任何指针或建议。不得已的方法是理解falcon源代码,并自己编写一个最小的API代码,该代码我已经开始了。