从html中打一个nodejs服务器
场景:我的html页面将一个json文件作为input,并将其发送到nodejs驱动的服务器组件。 可以说, myPage.html
是这个环境中的独立文件。
要求:我想捕获htmldep请求与json
embedded在httprequest正文。 我不知道如何从html页面调用nodejs应用程序。
提前致谢
要发送文件(embedded在多部分请求体中),只需要一个常规的HTML表单。
<form action="http://example.com/nodejs/endpoint" method="post" enctype="multipart/form-data"> <label> Select JSON file <input type="file" name="json"> </label> <input type="submit"> </form>