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
Express(backend)
Frontend review
html => structure
css => style
javascript => interaction
寫在index.js(前端ㄉjs)
Express
Express 是最受歡迎的 Node web框架,他定義了各種 middlewares 來協助 client 跟 server 進行溝通
http://expressjs.com/
安裝Express
先到
class03_NodeJS/example-server
底下init
會新增一個package.json檔,-y
代表 yes,並會以 default 的方式去 initial,不會一一詢問。--save
的意思是將這個 package 設定為本次專案的 dependency(告訴這個專案說:這次的專案需要依賴於這個模組才能運作)。設定伺服器(Server)
server.js
(後端ㄉ js)在 terminal 輸入
node server.js
看看會發生什麼?Routing
Routing 是把網址 (URL) 轉給特定程序處理的過程,告訴伺服器接收 Request 和回傳 Response 的方法
我們會針對不同 Request 設計做不同事情,回傳不同 Response
Sending Parameters:
req.params
Let's Play: Simple Login Server
Structure
1.
npm init -y
2.
npm install express
3. Set up routes for our GET requests
5. Start the server
node server.js
Challenage: Check password