Knockout + Node + Express + ArangoDB + Foxx + "LIKE search"
English:
- People.json ... a sample data from full JSON file used in this article. You can download it from here. (https://github.com/triAGENS/ArangoDB-Data/tree/master/RandomUsers)
- app.js ... a JS file located at not Express but Foxx app folder. Foxx publishes Web APIs of ArangoDB that's all separated from Express app.
- ***.ejs, first.ts ... files at Express app folder.
Before following steps, you have to create a collection with importing People.json on ArangoDB.
- "yo express" (view engine is EJS)
- Add a TypeScript file named first.ts to /public/js/ folder and edit it as my Gist code. (then compile it)
- Edit EJS files as my Gist code.
- Edit app.js at Foxx app folder as my Gist code. (in my case, folder location is C:\apps\detabases\_system\my_app) Maybe official docs help you. (http://docs.arangodb.org/Foxx/README.html)
- "grunt" at Express app folder. --> http://localhost:3000/ --> Oh, your Knockout is working with ArangoDB's Foxx now, then the most thing I wanna tell you is LIKE search is available :)
Japanese:
- People.json ... ArangoDBに作成するPeopleコレクションのサンプルデータです。こちらからダウンロードできます。(https://github.com/triAGENS/ArangoDB-Data/tree/master/RandomUsers)
- app.js ... Foxxフォルダに作成するJSファイルです。ArangoDBと連携してWeb APIを公開します。これはExpressから完全に独立しています。
- ~.ejs, first.ts ... Expressフォルダのファイルです。
以下の作業前に、ArangoDBにPeopleコレクションを作成しておく必要があります。People.jsonをインポートして作成しておきましょう。
- "yo express"を実行します。(view engineはEJSで)
- Expressフォルダの /public/js/ フォルダに first.ts という名前でTypeScriptファイルを作成し、私のGistコードのように入力してください。(コンパイルをお忘れなく)
- ExpressフォルダのEJSファイルを私のGistコードのように編集してください。
- Foxxフォルダに app.js ファイルを作成し、私のGistコードのように編集してください。(私の環境ではFoxxフォルダは C:\apps\detabases\_system\my_app\ です) 公式ドキュメントが参考になるでしょう。(http://docs.arangodb.org/Foxx/README.html)
- "grunt"を実行し、http://localhost:3000/にアクセスします。KnockoutがArangoDBのFoxxと連携して動作しているのがわかると思います。ちなみに私が最も伝えたいことは、LIKE検索ができるということです。