我对 Perl 框架 Dancer 非常陌生。截至目前,我有一个 get http 侦听器正在工作。我有一个 Angular 框架试图将 json 字符串发布到 Dancer。我如何检索 json 并可能将其分配给标量变量($json)。
get '/games' => sub {
header 'Access-Control-Allow-Origin' => '*';
&loadgames();
return $games;
};
post '/newgame' => sub {
header 'Access-Control-Allow-Origin' => '*';
#what should i put here to retrieve the json string
#I plan to pass the json string to a sub to convert to XML
};
Run Code Online (Sandbox Code Playgroud)
我不确定我是否选择 Dancer 作为获取和发布数据的后端框架。
谢谢您的帮助!