This file create from tour video of meteor project from http://www.meteor.com/screencast The project is use for demo ability of meteor framework by create software that display color name and let people to like it
- get meteor from http://win.meteor.com
meteor create tourcd tourgit init
other useful command = git help, git status
git add --allto add all file in root folder, not include .meteor filesgit commit --all --message "step 1: initial stage"
meteor run- open browse to localhost:3000
git add tour.html--> after edit html browser will live reloadgit commit --message "live reload"
git logto see history of master branch, use q to exit
this step show that you can use mongo api from client side (web browser)!! also html file show you a bit about how to use template
this step will implement color change when item was click. It's show how to use Session and click event
this step implement like button. Which when clicked will update like count on all browser.
It's show you one more time about template and event implementation
this step has no code change. but one more time show you via google chrome console that you can do lots of db api from client side. eg.
- Colors.find({likes: {$gt: 2}}).fetch()
- Colors.update({likes: {$gt: 2}}, {$inc: {like: 10}}, {multi: true})
- Color.remove({likes: 2})
show you that when you modify js file on server side. result immediately reflect to all open client --> user selection on color still maintain this is like you "push" the update software
instead of server emit data to template.
You can do by specify parameter in template, this case is {{how_many}} and let's server side to execute the code once this {{how_many}} value changes
this can do by single "deploy" command
meteor deploy gt-colors.meteor.com
noted: at the time I write, meteor 0.5.2 have rpc_callback bug so cannot > upload from my Windows system. It's will fix on version 0.5.3
no code for this step. Just show you how application work in real internet life, which database is too slow to wait. What meteor do is update user interface in advance to prevent sluggishness (you should watch screencast)
this can be done by "bundle" command
meteor bundle gt-colors.tgz
After you've got tgz file then extract and setup per README.md state.
unfortunately, as of Dec 25, 2012 you'll fail "Bundling is not yet supported on Windows. This requires reimplementing the (un)archiving of the bundle..." So here's workaround
- copy folder ".meteor\local\build_tar\bundle" underneath your project to whatever directory you want
- npm install fibers
- set environment variable by type
'set MONGO_URL=mongodb://127.0.0.1:27017/test'
'set ROOT_URL=http://example.com'
'set MAIL_URL=smtp://test:hana@mailhost:25/' - if you have appserv you'll got port 80 collision, so need to change port on server.js to other port 'var port = process.env.PORT ? parseInt(process.env.PORT) : 80;' node main.js
- create new repo at https://github.com/new
- add github server by type 'git remote add origin https://github.com/gampolt/meteor-tour.git'
- upload to server 'git push -u origin master'
your.gitconfig setup your configuration about password [user] email = xxxxx@xmail.com name = xxxxx [credential] helper = cache --timeout=3600
you should downoad git-credential-winstore also to resolve problem in windows look at here for more detail
- go to any folder
git clone https://github.com/gampolt/meteor-tour.gitcd meteor-tourmeteor run- open browser at http://localhost:3000
Good luck for your meteor journey :)