惊艳的基于nodejs的实时Web开发框架Meteor介绍

  昨天偶然发现了Meteor这个web开发框架,我接触过的各种语言的Web开发框架大概有十几个了,这个Meteor框架让我感到震惊,和其他的框架太不一样了(包括一些同样基于nodejs的框架如express等的,基于Python的新框架Flask,Tornado等)。

 Meteor是一个基于nodejs和mongodb数据库的实时web框架,前后端代码都是基于js开发,并且可以混合在一起,在开发时如果js,css,html等文件改了,页面会自动更新,同样如果mongodb数据库里面的数据修改了,页面也会自动更新,开发时根本不需要刷新了页面了,是不是很震惊!

  和其它新型框架一样,它也提供了meteor命令行工具,可以用来生成模版项目,并集成了nodejs和mongodb,上手很容易。另外还集成了cordova框架,用来封装App,支持Android和iOS平台。


 个人感觉这个框架适合拿来快速开发一些新型的实时网站,至于用来开发传统的Web应用,目前由于没有这方面的实际经验,还不确定是否适合。但Meteor在github上已经有22000多个star了,应该还是比较热门的。

下面是官方的介绍https://www.meteor.com/

Meteor
is an ultra-simple environment for building modern websites. What once took weeks, even with the best tools, now takes hours with Meteor.
The web was originally designed to work in the same way that mainframes worked in the 70s. The application server rendered a screen and sent it over the network to a dumb terminal. Whenever the user did anything, that server rerendered a whole new screen. This
model served the Web well for over a decade. It gave rise to LAMP, Rails, Django, PHP.
But the best teams, with the biggest budgets and the longest schedules, now build applications in JavaScript that run on the client. These apps have stellar interfaces. They don’t reload pages. They are reactive: changes from any client immediately appear on
everyone’s screen.
They’ve built them the hard way. Meteor makes it an order of magnitude simpler, and a lot more fun. You can build a complete application in a weekend, or a sufficiently caffeinated hackathon. No longer do you need to provision server resources, or deploy API
endpoints in the cloud, or manage a database, or wrangle an ORM layer, or swap back and forth between JavaScript and Ruby, or broadcast data invalidations to clients.

##Quick start!
The following works on all supported
platforms
.
Install Meteor:
$ curl https://install.meteor.com | /bin/sh

Create a project:
$ meteor create myapp

Run it locally:
$ cd myapp
$ meteor

# Meteor server running on: http://localhost:3000/

Unleash it on the world (on a free server we provide):
$ meteor deploy myapp.meteor.com

##Principles of Meteor

  • Data on the Wire. Meteor doesn’t send HTML over the network. The server sends data and lets the client render it.

  • One Language. Meteor lets you write both the client and the server parts of your application in JavaScript.

  • Database Everywhere. You can use the same methods to access your database from the client or the server.

  • Latency Compensation. On the client, Meteor prefetches data and simulates models to make it look like server method calls
    return instantly.

  • Full Stack Reactivity. In Meteor, realtime is the default. All layers, from database to template, update themselves automatically
    when necessary.

  • Embrace the Ecosystem. Meteor is open source and integrates with existing open source tools and frameworks.

  • Simplicity Equals Productivity. The best way to make something seem simple is to have it actually be simple.
    Meteor’s main functionality has clean, classically beautiful APIs.

##Learning Resources

There are many community resources for getting help with your app. If Meteor catches your interest, we hope you’ll get involved with the project!

TUTORIALGet started fast with the official
Meteor tutorial
!

Contents
,