Note
More UI demo images and system architecture design figures (e.g. UML class diagrams, UML sequence diagrams, Data Flow Diagrams, etc.) can be found in docs/README_img
directory.
- Front-end: Vue.js
- Server-side: Node.js - Express
- Database: MongoDB
Please refer to the following instructions to run our project in your local computer.
- Node.js
# open terminal in `front` directory
cd /note-squared/front
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test
For a detailed explanation on how things work, check out the guide and docs for vue-loader.
-
Node.js
Server will run in port 3000 (i.e.
localhost:3000
) -
MongoDB
For simplicity, we kept all the configurations of MongoDB as default.
- Make sure that MongoDB daemon is running in port 27017
- This project do not set any user & password for the database
- A database, named
note_squared
, will be created automatically after the server launches. You may check the data in it with MongoDB Compass.
# open terminal in `server` directory
cd /note-squared/server
# install dependencies
npm install
# serve with hot reload at localhost:3000
npm run dev
# OR you can run server without hot reload, using the following command
npm run start
You may deploy this project in a Linux server following the instructions below.
-
In
/front/src/axios.js
, replacelocalhost:3000
with your back-end API base URL, saynote.garychen.top:3000
:const http = axios.create({ baseURL:'http://localhost:3000/api/user' })
-
In
/front/src/main.js
, similarly replace the base URL:axios.defaults.baseURL = 'http://localhost:3000/api' Vue.prototype.$axios = axios
-
In
/front/src/utils/const.js
, similarly replace the base URL:export const hostAddr = "http://localhost:3000";
You may simply follow the normal procedures of deploying Vue project.
Here is a tutorial in YouTube for your reference: Deploy Vuejs App On Ubuntu Server.
cd /var/www/html/vue/note-squared/front
git pull
npm run build
-
Change server listening port if needed.
In
app/index.js
, update the following code:const PORT = 3000
-
Remove console log info if needed.
In
app/index.js
, update the following code:// print request info from front-end to console // (comment this out if you do not want to see the log) app.use(morgan('dev'))
-
Update database config if needed.
Go to
app/config/db.js
, update the config. -
Update secret key for jwt signing if needed.
Go to
app/config/key.js
, updatesecret_jwt
. -
Update email and password for sending verification code.
Go to
app/config/nodemailer.config.js
, update the following.// config of email sender const user = "note-squared@outlook.com" const pass = "xxxxxxxxxxxxxxx"
-
[IMPORTANT] Make the server really send the verification code emails.
-
Go to
app/router/user/register-email-verification-code.js
, uncomment the following:// send verification email // (temporarily removed) //await nodemailer.sendVerificationCode_register(_email, _email, _verificationCode)
-
Go to
app/router/user/set-pwd-email-verification-code.js
, uncomment the following:// send verification email // (temporarily removed) // await nodemailer.sendVerificationCode_resetPwd(user.name, _email, _verificationCode)
-
apt update
#apt install nginx
#service nginx status
apt install mongodb
service mongodb status
apt install npm
npm -v
node -v
# install `n` to manage node version
npm i -g n
n 12
#exit and login to server again
node -v
npm -v
git clone ...
# install dependencies
#npm i -g yarn
#yarn
npm install
#set nginx to deliver static files...
npm i -g pm2
pm2 start ...
#pm2 start app
#pm2 restart app
pm2 status
#set nginx again...
#set server to only listen to localhost...
Tutorial: https://www.youtube.com/watch?v=-oTdaFDvLo4
cd /root/note-squared/server
git pull
pm2 restart app