原创 Express Auth(權限管理)的設置 (二)
1. 使用 jwt 保存 token const jwt = require("jsonwebtoken"); 2. 在 userSchema 中創建methods, 不同於 statics 的是 methods 是用於 instan
原创 Complete REST API with MongoDB Atlas cloud, Node, and Express in 10 minutes
Let's bring the data to the cloud this time! 💾 ☁. And what better way to do that than a FREE cloud database! We'll be u
原创 Express Auth(權限管理)的設置 (五) 隱藏私有數據
有兩種方式,分手動和自動 1. 手動 修改返回 res 的數據,刪除 user 中的私有數據 res.send({ user: user.getPublicProfile(), token }); userSchema.methods
原创 Deploying a React app with React-Router and an Express Backend
https://dev.to/nburgess/creating-a-react-app-with-react-router-and-an-express-backend-33l3 In this article we will co
原创 Express Auth(權限管理)的設置 (一)
1. npm i bcryptjs 主要方法如下 const password = 'Red12345!' const hashedPassword = await bcrypt.hash(password, 8) hash方法中設
原创 (原創) Vue Router 中 3 種 route 的方式
1. router api <button class="link card-footer-item" @click="showDetail({name: 'hero-detail', params:{id: hero.id} })">
原创 Express Auth(權限管理)的設置 (三) 設置中間件
1. Without middleware: new request -> run route handler With middleware: new request -> do something -> run route
原创 [轉載] CSS如何實現文字兩端對齊
https://zhuanlan.zhihu.com/p/32354083 最近在工作項目中接觸到Web界面設計的問題,要實現文字兩端對齊的效果。在網上搜索了一下,差不多都是互相轉帖,用的都是類似的技巧: text-align:just
原创 display: inline 和 display: inline-block 的區別
inline 的 width 是佔用一行最小的空間 (take the smallest amout of space, possible),系統分配的。同理 block 是佔用一行最大的空間,也是系統分配的。 inline-block
原创 CSS clearfix "Hack"
沒有設置 container 容器 overflow: auto 以前 <div style="border: 1px solid red;"> <p> <img src="./css/repeat.pn
原创 [轉載]React跨域新版解決方案(v16.9)
https://zhuanlan.zhihu.com/p/96735100 React跨域 解決方案在二,想簡單瞭解下跨域的可讀一。 我們由於項目需要經常會需要對不同域名、不同子域的網站接口發起請求,有時甚至是對於同一域名的不同端口發
原创 CSS clear (float) 屬性
clear: both 表示不允許左右兩邊的 float clear: left 表示不允許左邊float clear: right 表示不允許右邊float
原创 React Redux 各部分解析
Reducer: 將 state 分類管理; 根據 action type, return 一個新的 state; Action: return 一個 object, type 是必需屬性; Action 要爲 pure function
原创 React 子組件傳父組件
父組件將 handler 方法名 通過 props 傳給 子組件; 子組件調用 handler 方法並傳入參數; 父組件實現 handler 方法並使用參數;
原创 關於 Form 的詳細說明
<form> 標籤 : 1. method: 如果設爲 "get", 提交的數據會寫入 request 的 query 中, 返回 url 地址中數據。常用在 google 等搜索引擎中的 form 數據提交; 一般情況下設爲 "post