2012年4月2日 星期一

[教學] Mojito 安裝與入門,install mojito for beginner.

mojito,最近終於從 YDN 對外公開此專案,這個套件主要用於解決前端多重裝置及瀏覽器端的問題,後端服務採取 node.js ,因此使用上必定要先準備以下幾個元素

準備素材

  • c++ complier
  • git
  • Node.js > 0.4.x
  • NPM > 1.0.x

安裝方式

git clone git://github.com/yahoo/mojito.git
cd mojito/source
sudo npm install -g .
npm install .
以上四個簡單的步驟,就可以把 mojito module 完整安裝到服務器上,接著就可以開始進入 mojito 的世界

使用方式

mojito 提供了完整的 command line 給開發者使用,接著先建立一個基本 hello world 專案,跟著以下步驟完成第一個專案。首先建立一個 mojito application,
mojito create app hello
cd hello
切換到目錄之後,再接著建立自己的 mojit,這邊的 mojit 就像是一個應用(application)可能會包含許多個獨立網站體,擁有獨立架構的 MVC ,包含內部設定等,詳細資料可以參考官方的說明,建立 mojit
mojito create mojit HelloMojit
輸入指令後,會看到顯示結果如下,
creating mojit called 'HelloMojit'
(using "default" archetype)
✔ mojit: HelloMojit created!
✔ mojito done.   
接著修改 application.json 這個 mojit 設定檔案,讓剛才新建立的 hellp application 指定底下有一個 mojit -> HelloMojit ,讓應用可以去執行 mojit controller ,修改如下,
[
  {
    "settings": [ "master" ],
    "appPort": 8666,
    "specs": {
      "hello": {
        "type": "HelloMojit"
      }
    }
  }
]
再修改 route.json ,指定應用的路徑會執行哪一個 controller ,修改如下,
[
  {
    "settings": [ "master" ],
    "hello index": {
      "verbs": ["get"],
      "path": "/",
      "call": "hello.index"
    }
  }
]

啟動 mojito 服務器

最後啟動 mojito 服務器,
mojito start
開啟瀏覽器,檢查是否執行正確
http://localhost:8666/
會顯示結果如下,
status
    Mojito is working.
data
    some: data    
恭喜,完成了第一個 mojito 應用程式。

後記

Yahoo 這次公開的 mojito 專案,是目前看起來架構、文件都是最完整的,同時也有提到可以透過 mojito 建構出多種不同裝置適用的 web app,同時裡面包含了 jslint, js compressor, l10n 等讓開發者可以透過 mojito 滿足許多需求,當然 mojito 也是可以融合 YUI 使用。
Node.JS 發展至今,加上其他開發者的投入,已經讓 JavaScript 這個語言在 web 有了不同的角色,橫跨前後端服務。

工商服務

體會 JavaScript 的優點、美好,歡迎關注 JSDC,台灣 JavaScript 盛會即將展開!


13 則留言:

匿名 提到...

Howdy! Someeone іnn my Myspace group shared this site with us so
I came to give it a looκ. I'm definitely enjoying the
information. I'm book-marking aոd will bbe tweeting hіs to my followers!
Great blog and wonderful stylee and design.

My blog post; best Baby monitors uk 2012

匿名 提到...

Back to year 2010, we may have experienced some
of our friends being layoff by the company and jobless to get a period of time.
However, you must be careful when using such codes.
After returning recently from Portabelo, Panama where the renowned pirater
expert and adventurer had the opportunity to dive on
and study several shipwrecks involved in Sir Francis Drake's burial at sea, (
Croce will speak about his adventures and the journeys of the pirates of St.

com friends inbox me that she what food was in typically the U.
Once you have look at this article you will not have to deal with
your traffic worries anymore. I believe that it can be done without the
check, if you keep talking to the two of them.
Among the most common methods are stealing passwords, email hacking and
phishing.

my webpage - pirater facebook gratuitement 2014 - facebook decryptor

匿名 提到...

WOW just what I was searching for. Came here by searching for

Also visit my webpage: bistro md diet

匿名 提到...

Speaking tom is now available via Intel Appup, which make every thing simple and hassle totally free to get it.
Here are the steps used to get talking tom to Computer.
The query is, do carriers lose cash on these offers.

Feel free to visit my webpage - kik setup for pc (http://testdrivinglife.blogspot.nl/)

匿名 提到...

Very good article! We are linking to this particularly great content
on our website. Keep up the good writing.

Look into my blog post :: Meska-apteka.pl

匿名 提到...

I am really grateful to the holder of this weeb site who has shared this enormous piece of writing at at this time.


Review my blog what is tinnitus a symptom of

匿名 提到...

Why viewers still mae use of to read news papers when inn this technological globe all iis existing on net?


mypage - marketing

匿名 提到...

I read this article fully concerning the difference of most recent and earlier
technologies, it's remarkable article.

my web page plumber snake Avondale

匿名 提到...

Hi there, just became alert to your blog through Google, and found that it is truly
informative. I am going to watch out for brussels.
I will be grateful if you continue this in future.

Many people will be benefited from your writing. Cheers!



Feel free to visit my blog; http://www.ashrafit.Com

匿名 提到...

Thank you for every other fantastic post. Where else could anybody get that type of info in such
an ideal means of writing? I have a presentation subsequent week, and
I'm at the look for such information.

My homepage; meal plans for weight loss

匿名 提到...

Wonderful beat ! I wish to apprentice at the same time
as you amend your website, how could i subscribe for a blog web site?
The account aided me a appropriate deal. I have been a little bit
familiar of this your broadcast provided vibrant transparent idea

Here is my web page ... 2015 Yukon

匿名 提到...

inquisitory to fin. This allows you to hurt collection which professionals wishing to hit his arm and a t-raiment about
your root or unit equity debt. Don't be bullied of sulfite warnings.
All wines do not roll in the hay when something happens where
you privation to regard wear, is Coach Outlet Coach Purses Outlet Coach Outlet Online Coach Outlet Coach Handbags Coach Outlet Online Coach Outlet can work you have an current
bear on, so use them on a regular basis, they retributive demand a one-restraint maker
for reformatory aggregation. to the highest degree problems with hostility headaches are no unlawful additions to your pieces
in collaboration, all the sentence. plan classes position to wear
aget dressed look on, that combines single flavors.

Take a look at my web-site - Coach Factory Online

匿名 提到...

Justin Bieber Kisses Selena Gomez at 2011 MTV VMAs. Mobile Holidays Examiner is interesting while sharing traditional
and bizarre holidays, food holidays along with history and trivia about fun holidays throughout the year.
He is the man behind Girls Gone Wild, and Kim is
at his home for the second time this summer.


Here is my web blog :: Kim Kardashian Hollywood
Hack - kimkardashianhollywoodhack.com -

張貼留言

Facebook