vue-express-mongodb
Vue.js and Express and MongoDB project
Thanks
Function
- find user
- add user
- token validate
- login intercept
Technology
- vue
- vue-router
- vuex
- express
- mongodb
- less/scss
- axios
- ElementUI
API
/api/user/useradd
/api/user/login
/api/user/getuser
Schema
const userSchema = mongoose.Schema({
userId: {
type: Number,
required: true
},
userPwd: {
type: String,
required: true
},
token: {
type: String,
required: true
},
create_time: {
type: Date,
required: true
}
})
demo
start server
Login and Register successfully
Token validate
Register validate
Login validate
Build Setup
# install dependencies
npm install
# run express server,this should be the first execution
# the server api run on localhost:3000
npm run server
# serve with hot reload at localhost:8080
# [HPM] Proxy created: /api -> http://127.0.0.1:3000/api/
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
For detailed explanation on how things work, checkout the guide and docs for vue-loader.