Giter Club home page Giter Club logo

mcunode-server's Introduction

McuNode-server

Free servers who use this program list :

McuNode server side,McuNode私有化服务端(ThreeFileVersion Recommend)

powered by BeeGo Firmwork

运行需要同时把对应架构的二进制程序和static与views两个文件夹放在同一个文件夹中

MCUNODE连接此服务端的8001

浏览器打开 http://127.0.0.1:<80/8080>/ 或者对应的公网ip

NODEMCU推荐使用https://github.com/IoTServ/McuNode-Lib 连接,该库集成了两种功能在一起并存

 当然你也可以使用分开的程序来定制自己的程序,https://github.com/IoTServ/McuNode

树莓派请使用LinuxArm和两个文件夹 或者你使用单文件的版本

##McuNode简介:

总览:

McuNode是一个主要针对于NodeMcu的服务端(包含在NodeMcu上运行的支持库),使用者可以运行自己的服务端为自己nodemcu提供云支持,当然你也可以将此服务端提供给他人使用,当前服务端由go语言编写理论上一般单核服务器可以支持多达几万的nodemcu同时连接提供服务。本项目主要支持如下功能:

  • 提供在线IDE功能(IDE提供一个基于web的云串口功能,完全实现原本的串口的lua解释器的访问功能;并且提供远程Lua程序升级功能实现基于互联网的完全的控制能力) image image
  • 提供一个类似于Nginx的web代理功能,它可以通过一个可以通过互联网访问的服务器访问nodemcu提供的网页,以此nodemcu编写的web server不仅可以在局域网可以访问,更重要的是McuNode-Lib还提供了一个很棒的文本框架帮助你完成这项工作,包括参数获取和模板文件的渲染等 image image

使用方法:

local mcunode = require "mcunode"
mcunode.connect("<id>","<server-ip>","<ssid>","<wifi-password>")  --自定义ID和使用的服务器地址(域名或ip),然后就是连接的热点信息

复杂一些的例子:

local mcunode = require "mcunode"

--url:http://mcunodeserver-ip/proxy/<your-id>/gpio?pin=1&val=0
--return:status=success
mcunode.handle("/gpio",function(req,res)
	local pin = req.getParam("pin")
	local val = req.getParam("val")
	if( pin ~= nil) and (val ~= nil) then
		print("pin: "..pin .." , val: " ..val)
		gpio.mode(pin, gpio.OUTPUT)
		gpio.write(pin, val)
		res.setAttribute("status","success")
	end
	return res
end)
mcunode.handle("/test",function(req,res)
	local name = req.getParam("name")
	res.setAttribute("name",name)
	res.body="wodename:{{name}}"
	return res
end)
--url:http://mcunodeserver-ip/proxy/<your-id>/index.html?name=farry&work=student
mcunode.handle("/index.html",function(req,res)
  local name = req.getParam("name")
  res.setAttribute("name",name)
  local work = req.getParam("work")
  res.setAttribute("work",work)
  res.file = "indextpl.html" -- ... <h1>{{name}}</h1> ...
  return res
end)
mcunode.connect("<id>","<server-ip>","<ssid>","<wifi-password>")

以上的复杂一些的例子需要一个模板文件indextpl.html,内容如下:

<h1>HELLO Farry</h1>
{{name}}:{{work}}
<h1>HELLO Farry</h1>
<h1>HELLO Farry</h1>
<h1>HELLO Farry</h1>
<h1>HELLO Farry</h1>
<h1>HELLO Farry</h1>

这个模板会被注册为/index.html的地址所使用,持续中先从URL中获取两个参数然后将两个参数又渲染到模板反馈给用户

而且以上两个程序已经同时支持了在线IDE的功能

非常希望 有人能提供运行本服务端的实例给大家使用,如果有请与我联系,我将在这里提供相关信息

mcunode-server's People

Contributors

iotserv avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.