or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Backend
http://homepage.ntu.edu.tw/~pollyhuang/teach/intro-cn-fall-19/slides.html
Notes
發一個 HTTP GET Request 大概像這樣:
Server 會回傳 Response:
List of status code: 不同 status code 代表不同意義,瀏覽器收到了前端才知道要做什麼對應
Tools
Postman
EditThisCookie
Flask
官網 + 教材
https://flask.palletsprojects.com/en/1.1.x/quickstart/
Installation
server.py
Express
官網 + 教材
https://expressjs.com/en/starter/installing.html
Installation
server.js
auto restart
Cookie/Session
key value pair, 一個名字一個對應值
可以在 console 裡打
document.cookie
看到登入後,server看你的帳號密碼看看是不是你,是的話就給你一串神秘字串,然後傳的時候會有下面的這樣:
HTTP Response 會有 Set-Cookie:
session="神秘字串"
瀏覽器就會把這段放在 cookie 裡
之後你再次發 HTTP Request 的時候就可以帶 cookie 過去,這樣 server 只要看這個神秘字串就當作你登入了,你就不用每次都重新打帳號密碼了!
/login
-> return html form,可以輸入 username
-> 拿到你的輸入,看看是不是合法的使用者
Q&A
secret key?
flask 內的 session(概念圖):
Database
mongoDB
redis
SQL
補充
python decorator: 幫 function 包裝更多功能
python format string
python byte string