你好,请教一下,我在APP上起了httpServer
代码如下:
复制代码 export default {
data() {
return {
title: 'Hello',
hs: false,
}
},
onLoad() {
this.hs = uni.requireNativePlugin('YPL-httpserver');
this.hs.startServer({host:'192.168.0.58', port:9876},res => {
// 回调结果
console.log(res)
});
root:plus.io.convertLocalFileSystemURL("_www")
console.log(plus.io.convertLocalFileSystemURL("_www"))
},
onUnload() {
this.hs.stopServer();
},
methods: {
} // end of methods
}
打印结果如下:
复制代码15:43:14.603 应用【httpServerDemo】已启动...
15:43:15.129 App Launch at App.vue:4
15:43:15.154 App Show at App.vue:7
15:43:15.832 /storage/emulated/0/Android/data/uni.UNI3B0E10C/apps/__UNI__3B0E10C/www/ at pages/index/index.vue:25
15:43:15.855 [Object] {"start":true,"httpServer":{}} at pages/index/index.vue:22
现在我要接收POST数据,要怎么弄?
1 个回复
ican - 全栈开发
你好,目前插件提供静态网站的访问,对于在js中处理服务器请求的需要,下个版本增加