我正在使用 nodejs 创建 API。API 接受请求并以 JSON 响应
例如:我的数据库中有一个表 QUESTION,因此对端点http://localhost/table/question的 GET 请求将以 JSON 格式输出该表。
但是在执行 JOINS 时出现问题
考虑表 QUESTION 和 CHOICE。一个问题有很多选择(答案),他们的加入将是
桌子:
我正在尝试转换为这样的东西
{
"0":{
"QUESTION":"If Size of integer pointer is 4 Bytes what is size of float pointer ?",
"OPTION":{
"A":"3 Bytes",
"B":"32 Bits",
"C":"64 Bits",
"D":"12 Bytes"
}
},
"1":{
"QUESTION":"Which one is not a SFR",
"OPTION":{
"A":"PC",
"B":"R1",
"C":"SBUF"
}
},
"2":{
"QUESTION":"What is Size of DPTR in 8051",
"OPTION":{
"A":"16 Bits",
"B":"8 Bytes",
"C":"8 Bits" …Run Code Online (Sandbox Code Playgroud)