跳到主要內容

[教學] 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. 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 -

    回覆刪除

張貼留言

這個網誌中的熱門文章

面試者如何挑戰大工程師時代來臨?

面試者如何挑戰大工程師時代來臨? 全世界都在倡導轉職成為工程師,似乎轉職成為工程師就成為職場的救贖,真的是如此嗎?讓老衲來杠給各位聽。 最近有位好久不見的小朋友,是 2000 年出生的小蔡,對於即將面臨到面對職場的挑戰開始關心起技術,他開始尋找比較適合自己的領域,同時也開始在思考到底為了接下來的就職小蔡該如何準備。 詢問我說是不是可以考慮軟體開發工程師這條路線 對於他的詢問,反而引起我的注意, 這讓我開始思考並映射於最近招募的經驗,軟體開發此領域是不是對於每個人都是可以擔任的職啀,這邊分享一些自己的看法希望對各位有所幫助。 全民工程師這件事情 在全球景氣低迷的狀況下,的確特別在這一年大家會很有感覺萬物齊漲,薪水不漲,薪資就是一直停滯不前。 很多時候,在不同的領域中,會發現整個薪資就算是擔任了管理職務主管你也會面臨到薪資的強大屏障在自己面前。 這個時候, 軟體工程師年薪百萬口號 似乎就成了一種救贖。 好像成為了工程師就可以達到年薪百萬,在家輕鬆工作,不用打卡也不用受到風吹雨淋,隨時想工作就可以工作,每個月又有固定薪水入帳,感受到類財富自由,人生的美好。 如果能夠爭取到跨國公司的職位,這份薪水有可能還可以上看每個月十多萬以上,甚至是往上也是極度有可能的事情,人生美好層次又再度提高了起來。 但這件事情是真的每個人都可以達到嗎? 還是這就是另外一種性存者偏差呢? 亦或者這些人其實是金字塔頂端的小眾? 每份履歷都像是同一種履歷 最近在最近幾年在面試工程師的時候特別會看到許多轉職者,一開始履歷裡面看到相關的作品一開始會覺得十分的驚艷, Wow, 現在的新手就可以做到如此精美的畫面,這些畫面是我當初用 Bootstrap 也做不出來的東西,許多的互動體驗好的一個不行,做出來的頁面配色和對齊也是極致。 但是隨著時間推移,多看了幾封履歷之後,就會發現在各大技術養成學院出來的學生履歷成果內容如出一轍,在面試的過程中也會詢問許多關於框架的底層概念,和比較技術觀念的時候,甚至是許多框架的核心概念,就很容易露出馬腳。 很多面試者會 一問三不知 ,透過許多引導,但殘酷的是連關鍵字是什麼都也無法推敲出來,更不用說在小組裡面到底怎麼樣合作,許多不同線上產品的比較,使用者流程,使用者後面的互動邏輯等,幾乎是風吹一片倒,只能

jQuery, animate function with css exlapenation.

Today, I want to use jQuery making a animation for webpage, First I check animate fuction on ref book. I clearly know how use it, there are two main function for animate. 1. $().animate({ "style1":"value1" , "style2":"value2" }, Time); Time: it can be three type, String => "slow", "fast", "normal". Integer=>10000 2. $().stop(); it can immedaitely stop animation. Let's do some experieces, I bulit a simple page. You can hover UP and DOWN for a article sliding UP or DOWN. Les't do it. HTML CODE: <div id="all"> <div id="up">往上</div> <div id="showTab"> <div id="data"> About This script is intended for forms where the user needs to upload an image to a Web site. The image is displayed on the page for previewing before uploading. The display will be resized if needed so as not to break the page layout. Valid file types are set in the scri

初探 LangChain:語言模型應用程式開發的強大框架

LangChain 是一個強大的框架,致力於幫助開發人員利用語言模型構建端到端的應用程式。它提供了一整套工具、組件和接口,大大簡化了創建由大型語言模型(LLM)和聊天模型支持的應用程式的過程。LangChain 可以輕鬆地管理與語言模型的互動,將多個組件連接在一起,並集成額外的資源,例如 API 和資料庫。 LangChain https://python.langchain.com/en/latest/index.html 不說廢話,直接開始試著安裝, pip install langchain pip install openai export OPENAI_API_KEY="..." 以下是一些 LangChain 的簡單程式碼: import os os.environ["OPENAI_API_KEY"] = "..." from langchain.llms import OpenAI from langchain import OpenAI, ConversationChain from langchain.agents import initialize_agent from langchain.agents import load_tools from langchain.chains import LLMChain from langchain.prompts import PromptTemplate prompt = PromptTemplate( input_variables=["product"], template="What is a good name for a company that makes {product}?", ) print(prompt.format(product="colorful socks")) # What is a good name for a company that makes colorful socks? 在 LangChain 中,開發人員可以使用 LLM、Chat Model、Agents、Chains、Memory