Hoolev Linux, Network, Coding

为什么是Meteor

这里不是介绍什么是Meteor,关于什么是Meteor,这篇博客说的很好。 这里只是试图说明在JuBo这个智能无线路由器中为什么选择Meteor这个新兴的,目前连稳定版本都没有的平台作为其基础框架。

##Meteor是什么 Meteor的官网(https://www.meteor.com/) 这样介绍这个框架:

Meteor is an open-source platform for building top-quality web apps in a fraction of the time, whether you’re an expert developer or just getting started.

具体来说Meteor是一个基于NodeJS和Mongodb的实时Web应用开发平台,它不仅仅提供一个JavaScript编码框架,还提供了一种创新方式来构建可伸缩、交互式的富Web 应用程序。

##JuBo是什么 巨柏(JuBo)又名雅鲁藏布江柏木,分布于雅鲁藏布江(Yarlung Zangbo)沿江地段的中国特有珍稀树种。 JuBo,一个基于OpenWrt和Metror的用于智能无线路由器的开放平台。 我们认为JuBo应该是这样的一个平台:

  • 统一的编程语言
  • 开放的API,丰富多样的APP
  • 安全高性能的路由
  • 共享的网络

我们希望JuBo能够构建一个独特的智能无线路由器生态系统,改善用户使用无线路由器的体验,减轻应用开发者的工作。

##选择Meteor 说起无线路由器,大家首先想到的应该是角落里默默无闻一身灰尘的四方盒子。 对于这样一个没有屏幕的设备,Web APP是用户和设备之间最好的桥梁。总所周知,在Web开发中前台开发和后台开发是很不搭界的。 两者使用的语言、开发工具和思维方式都有很大的差异,但是对于一个开放平台的APP开发来说,统一的语言和统一的开发方式是必须的。 也就是说我们需要一个完整的全栈式开发平台,便于应用的开发和管理。

Meteor架构于NodeJS之上,前端和后端开发统一使用JavaScript语言,同时可依托NodeJs上的强大类库和众多开源项目。 Meteor统一了服务器段和客户端的数据访问(服务器端使用MongoDB,客户端使用minimongo),提出Database Everywhere原则。 Meteor提供了一组基本的JavaScript API和一个智能简单的部署方式。 因此在Meteor的基础上,可以很快的构建一个应用开发和发布平台。

Meteor的七大原则:

Data on the Wire. Don’t send HTML over the network. Send data and let the client decide how to render it.

One Language. Write both the client and the server parts of your interface in JavaScript.

Database Everywhere. Use the same transparent API to access your database from the client or the server.

Latency Compensation. On the client, use prefetching and model simulation to make it look like you have a zero-latency connection to the database.

Full Stack Reactivity. Make realtime the default. All layers, from database to template, should make an event-driven interface available.

Embrace the Ecosystem. Meteor is open source and integrates, rather than replaces, existing open source tools and frameworks.

Simplicity Equals Productivity. The best way to make something seem simple is to have it actually be simple. Accomplish this through clean, classically beautiful APIs.

##不足之处 Meteor联合创始人Matt DeBergalis在接受采访时说:

Meteor and DDP are excellent fits for the Internet of Things and the rise of embedded networked devices.

Meteor简单快速的Web APP开发方式,数据实时更新的特点很好的解决了物联网和嵌入式网络设备的管理和监控问题。 但是目前的Meteor对于存储空间小的嵌入式设备还不太友好,其中MongoDB的移植就会占用很大的存储空间。 因此把Meteor移植到无线路由器上,至少要替换掉MongoDB或者想办法减少MongoDB的体积。