- node.js v-10.15.0
- bcrypt-nodejs
- bcryptjs
- body-parser
- bootstrap-select
- chai
- connect-flash
- dotenv
- express
- express-handlebars
- express-session
- faker
- imgur-node-api
- jquery
- jsdom
- jsonwebtoken
- loadsh
- method-override
- mocha
- moment
- multer
- mysql2
- passport
- passport-jwt
- passport-local
- sequelize
- sequelize-cli
- sinon
- sinon-chai
- socket.io
- sequelize-test-helpers
- supertest
確認本機是否安裝 MySql
git clone https://github.com/whynotwilson/simple-twitter-express-starter.git
1. 切換目錄到專案: cd simple-twitter-express-starter
2. 安裝套件: npm install
3. 進入[圖片網站 Imgur](https://api.imgur.com/oauth2/addclient) 註冊,取得clientID
4. 建立.env的檔案,將上述取得的clientID以及自訂的JWT secret code貼至下方
- IMGUR_CLIENT_ID=<Imgur clientID>
- JWT_SECRET=<JWT SECRET>
- 修改 development mode 的設定,加入資料庫的名字與密碼,刪除"operatorsAliases": false
"development": {
"username": "root",
"password": "your password",
"database": "ac_twitter_workspace",
"host": "127.0.0.1",
"dialect": "mysql",
"operatorsAliases": false
}
- 請在 MySQL Workbench 輸入下方指令,建立 ac_twitter_workspace 資料庫
create database ac_twitter_workspace
- npx sequelize db:migrate
- npx sequelize db:seed:all
1. 終端機輸入: npm run dev
2. 開啟網頁輸入: http://localhost:3000
Name | Password | 預設權限 | |
---|---|---|---|
root | root@example.com | 12345678 | admin |
user1 | user1@example.com | 12345678 | user |
user2 | user2@example.com | 12345678 | user |