phodal / iot-coap Goto Github PK
View Code? Open in Web Editor NEWIoT Learning with CoAP Protocol
Home Page: http://coap.phodal.com/
License: MIT License
IoT Learning with CoAP Protocol
Home Page: http://coap.phodal.com/
License: MIT License
#2014-09-03 的分格线
后续有真实硬件设备后需要增加调整的功能:
1)"key":[
"id",
"value",
"sensors1",
"sensors2"
],
应该改为
"key":[
"id",
"sensor",
"value",
"binary"
],
restful 格式为 coap://127.0.0.1/v1/id/1/sensor/2/value/{json}
或者 coap://127.0.0.1/v1/id/1/sensor/2/binary/{...bin}
2)上面的{}里面的内容必须包含两个键值,一个时间戳,一个数据
3) 客户端支持 highchart 来生成实时曲线
4)数据库要调整,大家多讨论讨论
index[primary key], id, sensor, value_ts, value_data
#2014-09-11 的分格线
#2014-09-12 的分格线
#2014-09-13 的分格线
use Promise Design Pattern to replace the callback hell.
使用Promise设计模式来代替现在的回调。
下面RESTful准则是由HTTP,Apache的设计者Fielding大神提出的,很有参考价值:
An API is a user interface for a developer - so put some effort into making it pleasant
Use RESTful URLs and actions
Use SSL everywhere, no exceptions
An API is only as good as its documentation - so have great documentation
尽量采用类似 https://www.foo.com/v1/ 结构,这样更加直观
Use query parameters for advanced filtering, sorting & searching
Provide a way to limit which fields are returned from the API
Return something useful from POST, PATCH & PUT requests
HATEOAS isn't practical just yet
XML有更好的可读性和结构性,但是JSON适合机器阅读,具有更好的效率和更小的空间。JSON天然的和JavaScript结合得很好,使得JSON更适合RESTful架构
You should use camelCase with JSON, but snake_case is 20% easier to read
Pretty print by default & ensure gzip is supported
Don't use response envelopes by default
Consider using JSON for POST, PUT and PATCH request bodies
Paginate using Link headers
Provide a way to autoload related resource representations
Provide a way to override the HTTP method
Provide useful response headers for rate limiting
Use token based authentication, transported over OAuth2 where delegation is needed
Include response headers that facilitate caching
Define a consumable error payload
Effectively use HTTP Status codes
在获取/id/时,应该返回全部结果。
如
function url_sanity_check(url) {
if(url.split('/')[2] == false){
return false;
}
_.each(config["key"], function (array, index) {
if(url.split('/')[1] === config["key"][index] ){
return true;
}
});
}
关于URL的配置应该放在iot.json中
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.