跳到主要內容

[教學] 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 盛會即將展開!


留言

  1. 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

    回覆刪除
  2. 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

    回覆刪除
  3. WOW just what I was searching for. Came here by searching for

    Also visit my webpage: bistro md diet

    回覆刪除
  4. 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/)

    回覆刪除
  5. 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

    回覆刪除
  6. 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

    回覆刪除
  7. Why viewers still mae use of to read news papers when inn this technological globe all iis existing on net?


    mypage - marketing

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

    my web page plumber snake Avondale

    回覆刪除
  9. 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

    回覆刪除
  10. 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

    回覆刪除
  11. 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

    回覆刪除
  12. 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

    回覆刪除
  13. 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 -

    回覆刪除

張貼留言

這個網誌中的熱門文章

[分享] 腳踏車環島注意事項

很多人都期望自己能夠做點什麼,做些什麼,而退伍之後的第二個星期,就展開了環島之旅。 對很多人來說這不算什麼,甚至有人展開了走路、跑步、溜滑板、單輪車等方式環島一周,充分展現對台灣的愛與關懷。 這篇主要讓不知道怎麼準備環島的人,作一個完善的解說,首先隨身的東西要有: 證件現金類 : 身份證 健保卡 學生證 現金 提款卡 悠遊卡

直播錄影設備大公開 - 從線下轉線上到底要哪些裝備

直播錄影設備分享 蠻多朋友都在敲碗詢問,到底一場直播需要準備哪些設備,這邊聽筆者娓娓道來, 網路 好的網路上天堂,壞的網路會讓你掉落到不知道什麼地方。 會建議大家至少是一個獨立的 4G 訊號,意味著當下至少要有 30MB/s 的上傳下載,這樣在透過 Google Meet / Zoom 視訊會議的時候是比較不會卡頓的狀態。 Google Meet 輔助文件 有提到關於頻寬的最低需求, 對位於 8.8.8.8. 的 Google 公用 DNS 伺服器執行連線偵測 (ping) 測試時,延遲時間應低於 50 毫秒。 參與者的上傳訊號 (無論通訊人數多寡) 應符合 3.2 mbps 的頻寬需求。 抓在這樣的標準之上會是比較穩定的, 如果你的需求是要透過 OBS 同時播出到 youtube live / Facebook live 和多個頻道的時候,會建議需要更高頻寬,最好是連接有線網路的狀況下尤佳。 總之,網路越快越好,直接光纖肯定沒錯!(可惜我家無法 …T_T 麥克風 直接說答案,這邊採用的是   Rode Wireless go 購買網址: https://24h.pchome.com.tw/prod/DGCF07-A900B6O2U 沒有考慮類似圓剛 av310 或者 BlueYite 之類的,主要是因為可能當初規劃會有起身轉場可能,且可以支援一對多的方式進行訪談式收音。 但很可惜的是,沒有朋友!(威 Rode Wireless go 的優勢在於內建獨立麥克風,可直接夾在領夾上,或者連接更好的收音麥克風,當作訊號源來處理,可變化性蠻大的,但對於聲音細緻度,可能就沒辦法要求到這麼多,總之是不同面向考量下的選擇。 燈光 首先燈光會比攝影機要重要許多許多許多,一個好的麥克風,加上好的燈光,基本上背景只要稍微設置一下,就可以美美搭。 6 寸桌上型 LED 網美燈 購買網址: https://24h.pchome.com.tw/prod/DGCF2O-A900AFG98?fq=/S/DGCF2O 道蝦皮找應該可以找到許多更便宜的,以目前來說 6 寸網美 LED 環形燈來說算是堪用,為什麼會說堪用,如果場景允許,實際上再加上左右補光會讓畫面呈現效果更佳。 目前上述的需求,都是以大頭照拍攝,或者半身的需求為主。 如果說要拍到全身的話,基本上就是直上攝影用補光燈,這就不在此範圍內

[教學] 快快樂樂刪除CodeIgniter index.php

預設的CI網址預設都設定為index.php同一層級,因此所有的程式都必須指定index.php導向才能開始,例如 http://localhost/ci/index.php/welcome/test http://localhost/ci/welcome/test 本文將說明如何將惱人的index.php消除,還你一個漂亮的URL。 設定開始: 接下來說明如何使用rewrite方式將惱人的index.php去除。 rewrite不清楚的人,煩請先自行google 首先要先確定Apache的 mod_rewrite 有 開啟 ,如果沒有開啟請設定好之後重新啟動apache。 接著,在根目錄底下建立一個新檔案,檔名為 .htaccess ,裡面程式碼如下: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> 接著到 application/config/config.php ,開啟檔案修改 $config['index_page'] = ""; 注意: /index.php/$1 要根據你目錄,例如 http://localhost/index.php ,網站根目錄為 /ci/index.php 則要寫成 /ci/index.php/$1 接著至CI目錄下,尋找 config\config.php , 修改一下裡面的檔案,修改如下: $config['index_page'] = ""; 存檔後,如此一來大功告成。 參考資料 官方網站說明