| title | 本組後端測試架構 |
|---|---|
| lang | zh-tw |
| tags | uidd |
成var(--var_vw)
例如94vw要成為calc(var(--var_vw)*94)
成var(--var_vw)*100
例如
#menu_back {
position: absolute;
width: calc(var(--var_vw)*100);
height: calc(var(--var_vw)*23 + 3vh);
bottom: 0px;
z-index: 5;
}
的width
成var(--var_right_global_displacement)
例如
#medal_block {
z-index: 5;
position: absolute;
width: calc(var(--var_vw)*18);
right: calc(var(--var_right_global_displacement) + 5%);
top: calc(var(--var_vw)*20);
text-align: center;
}
動物:
document.getElementById('jade_user_info_choosedanimal').innerText
主頁面+發文:/view/main 選角:/view/layout
其中所有的html發送router需使用
router.get('/', ensureAuthenticated, function (req, res, next) {
Person.getPersonal(req.user.username, function (err, Personget) {
if (err) throw err;
res.render('main', {
title: 'old_friend',
var_jade_user_info_name: `${req.user.name}`,
var_jade_user_info_username: `${req.user.username}`,
var_jade_user_info_profileimage: `${req.user.profileimage}`,
var_jade_user_info_choosedanimal: `${(!Personget)?'-1':Personget.animal}`
});
});
});
方可正常作動
請至雲端硬碟「密碼與私鑰」資料夾下載裡面的Variouskeys資料夾,整個放到本REPO中方可運作
請先npm i再做其他動作
原本做的是前端的登入,但是問題是:怎麼確定前端登入完的資訊傳到後端不會被修改
修正方式 https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow?locale=zh_HK
參考資料 https://ithelp.ithome.com.tw/articles/10197391
使用套件 http://www.passportjs.org/ https://github.com/jaredhanson/passport-facebook
套件參數 ['id', 'name', 'displayName', 'gender', 'emails', 'photos', 'hometown', 'profileUrl', 'friends']
- keep刪除時的作動,會造成後端程式碼crash
- 捲動更新,當內容物太少,無法捲動時,無法更新
- 把發文時間記在硬碟中,看是要把那個記錄檔變成隱藏檔,還是要用其他方法去紀錄<<<這是一個次級的錯誤,不用改只要會動也沒關係>>>
code:
fs.writeFile(`${__dirname}/poops.json`, newpooptime, (err) => {
if (err) throw err
var id = {};
id["id"] = newPoop._id;
res.status(200).send(JSON.stringify(id));
})
- 前端的css、js請一律放在resources資料夾 (與html分開)
img放在
resources/img
-
主程式清理,請地圖合成進主程式;刪除在後端repo中FBlogin資料夾
-
FB登入還沒合併進入主程式...待做
-
各個router要加上使用這驗證(看line群組)
- luffy
- node js
- Express
- mongo db
- passport
- go to luffy
vi backend_setup.sh- paste these code
#!/bin/bash
cd ~
mkdir backend_try
cd backend_try
npm install express
npm install express-generator
git clone https://github.com/andythebreaker/backend_pet.git
cd backend_pet
mkdir ../garbage
mv node_modules ../garbage
rm *.txt
rm package-lock.json
rsync -r . ..
cd ..
search='mongodb://localhost:27017/nodeauth'
replace='mongodb://帳:密@140.116.132.223:27017/petdatabase_dev'
filename='./models/user.js'
sed -i "s#${search}#${replace}#gi" $filename
# Ask the user for their name
echo enter a port you like:
read varname
search='3000'
filename='./bin/www'
sed -i "s#${search}#${varname}#gi" $filename
npm install
npm start
sh backend_setup.sh- it will ask for port, type something (e.g.:19812)
- 如果你有放乖乖的話,他應該會跑...一直跑
- 打開瀏覽器,輸入
luffy.ee.ncku.edu.tw:[port]you'll see this - you can input
- username
nini - password
nini
- you will then see welcome
- you can find a log out btn., press it, then logout
- 可以任意測試註冊等等行為
cd ~/backend_trynpm start
參考本文件最末端:「附加文件」章節 可以照「附加文件」中描述的方法以gui查看此資料庫
- Studio 3T
- MongoDBCompass
- postman
- wireshark
postluffy.ee.ncku.edu.tw:[port]/users/loginbody 設定X-www......- 送出
getluffy.ee.ncku.edu.tw:[port]/users/logoutbody設定可以空白- 可以再做更多測試...也沒幾個指令啦
這些程式碼在幹嘛請看以下url
https://ithelp.ithome.com.tw/articles/10189263
這份教學文件因年代久遠,有諸多錯誤,使用上還需多加留意
可參考https://github.com/andythebreaker/backend_pet.git做出的實踐
適用日期在20210331測試可行
請至本組共用雲端硬碟>全域資源>技術文件>資料庫>下載其中的pptx檔案
- 其中第1至5頁描述了在本次實作中所採與用的mongodb資料庫
- 第6至9頁描述了如何以gui查看此資料庫
- 剩下的部分描述了一些注意事項
錯誤或待修正
- 存取權限未配置
- luffy以後會提供有配置好存取權限的帳號
請查看專案根目錄中如下檔案
並將該檔案中資料庫路徑更正(參考上方.sh程式碼)
須更正的東東如下
{%hackmd B145hRQ2U %}









