由 mongoDB 與 nodeJS 開發的短網址產生器 DEMO
- 複製一個網址
- 按下
copy
一件複製產生下來的網址
- 下載專案壓縮檔或使用git clone至個人電腦
git clone https://github.com/stylelinz/shorten-url.git
- 進入專案資料夾,在終端機輸入以下指令
cd shorten-url
- 安裝npm套件,在終端機輸入以下指令
npm install
npm i nodemon
- 在終端機輸入以下指令新增種子資料
npm run seed
- 啟動伺服器,執行 app.js 檔案,輸入以下指令
npm run dev
- 當終端機出現以下字樣,表示伺服器與資料庫已啟動並成功連結,可以在瀏覽器觀看 http://localhost:3000
Express is listening on http://localhost:3000
mongodb connected!
- 在終端機按下
ctrl
+c
或cmd
+c
,以關閉伺服器