我有一个函数,它接受一个字符向量作为参数,处理后返回一个结果。
我想使用管道工将其作为 API 公开。如何将 JSON 作为输入传递
我使用了以下代码
file_recommender = function(req,res,files){
files = as.data.frame(files)
files = files$name
files = as.character(files)
library(dplyr)
return(files)
}
在 http 请求中,我将数据发送为
http://127.0.0.1:8000/get_file_recommendation?files=[{"name":"pvdxmanager.h"}]
http://127.0.0.1:8000/get_file_recommendation?files={name":["pvsignmanager.cpp","pvdxmanager.cpp","pvorderoperationsmanager.h"]}