### More on Backend and DB -- Create a Very Simple Chat App ![](https://i.imgur.com/3WyMGV2.png) Spring 2019 。 Ric Huang --- ### This has been a crazy week... so sorry I don't have much time to work on the slides... --- ### Anyway, please start by downloading the simple chat app [here](https://github.com/ric2k1/ric2k1.github.io/blob/master/W10_0424/rics_chat_boilerplate.tgz) --- ### A Very Simple Chat App * tar zxvf rics_chat_boilerplate.tgz * cd rics_chat_boilerplate; npm install * Go to "https://mlab.com/home" to apply for a FREE MongoDB service * npm start --- ### Mongoose: A JS MongoDB ORM * Official documents [[link](https://mongoosejs.com/docs/documents.html)] * ORM = Objec Relational Mapping, *"透過程式語言(Ruby, Java),去操作資料庫語言( SQL )。而這也是實作了物件導向的概念,產生的一種工具模式"*([ref](https://ithelp.ithome.com.tw/articles/10207752)) ---- ### MongoDB * Official Website ([link](https://www.mongodb.com/)) * *"MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need"* * 簡單的說,就是 data 以類似 JSON (Key-value pairs) 的方式儲存在資料庫裡面 ---- ### 補充:Relational Database ([slides from 106-2](https://github.com/ric2k1/ric2k1.github.io/blob/master/W10_0424/ref/11.%20Database.pdf)) --- ### A Simple Web Service Framework ![](https://i.imgur.com/goBJyU6.png) --- ### A Simple Chat App * File structure ``` > server.js // server program models/message.js // to work with Mongoose ORM > public/index.html // client view public/script.js // to handle socket.io communication ``` // Taken from ([ref](https://github.com/bradtraversy/mongochat)) --- ### Midterm Individual Project (20%) * 題目自訂,一個人一組, details TBA * Requirements * Client-side programs in React.js * Server-side programs in Node.js * Recommended * Database to store persistent data * Use "Promise" or "Async/Await" to ensure asynchronous non-blocking communications * Deadline: 9pm, Tuesday, 05/14 --- ### That's it! ### 下星期停課 ([F8 Conference](https://www.f8.com/)) ### 下下星期會補充一些 backend/DB 的知識
{"metaMigratedAt":"2023-06-14T21:17:35.027Z","metaMigratedFrom":"YAML","title":"More on Backend and Database -- Create a Very Simple Chat App (04/24)","breaks":true,"slideOptions":"{\"theme\":\"beige\",\"transition\":\"fade\",\"slidenumber\":true}","contributors":"[{\"id\":\"752a44cb-2596-4186-8de2-038ab32eec6b\",\"add\":2505,\"del\":143}]"}
    1378 views