在服务器端,有什么方法可以检测来自移动设备(来自移动应用程序)的特定 API 请求?我了解用户代理嗅探,但我不喜欢这种方法,因为没有足够的理由不实施它。我还知道,当来自我的移动应用程序时,我可以添加一些标记来请求,但这似乎也有点脏。实际上有什么“正确”的方法可以做到这一点吗?
我想它没有太大变化,但我的后端是在node.js 中。
问候,谢谢!汤姆
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
int main ()
{
char name[20];
fd_set input_set;
struct timeval timeout;
int ready_for_reading = 0;
int read_bytes = 0;
/* Empty the FD Set */
FD_ZERO(&input_set );
/* Listen to the input descriptor */
FD_SET(0, &input_set);
/* Waiting for some seconds */
timeout.tv_sec = 10; // 10 seconds
timeout.tv_usec = 0; // 0 milliseconds
/* Invitation for the user to write something */
printf("Enter Username: (in 15 seconds)\n");
printf("Time start now!!!\n");
/* …Run Code Online (Sandbox Code Playgroud) 我正在使用node.js,express和mongodb用Javascript编写一个项目,其中包括一个用于将图像发布到服务器的API。
当获取它们时,必要的参数会放在查询字符串中,例如:
domain.com/api/imgs?firstParam=XXX&secondParam=YYY
Run Code Online (Sandbox Code Playgroud)
不确定发送POST数据的最佳方法。到目前为止,我的想法是:
完全在查询字符串中发送数据(base64编码的img本身除外,它将在POST数据中)
重用查询字符串中的GET参数(我需要更新DB中的数据),然后使用POST发送其他参数
在这种情况下,最佳做法是什么?