Deprecated! Now demo project was generated by script automatically. Please check https://github.com/erguotou520/vue-fullstack/tree/vf-backend for backend server and https://github.com/erguotou520/vue-fullstack/tree/vf-mock for mock server
This is a NodeJs fullstack project using express, mongodb, passport, vue, vue-router, vuex, etc.
- Separate for backend and frontend when development
- Configurable
- Restfull api
- Install
mongodbfollow official manual. It's recommend to use MongoChef as the db client. - NodeJs installed.
- Open terminal and run
npm install, if you don't choose i18n when initialization, you need to runnpm run remove:i18nhere manually - Run
npm run server, this will initial the db andUserdocument if not exists - Open other terminal and run
npm run client, you can combine the two command withnpm run dev - Open browser and nav to
localhost:9001(the default port is 9001, if you change this, change the port)
Run npm run build
├─client # frontend source folder
│ ├─build # frontend dev scripts
│ ├─src # frontend src
│ │ ├─assets
│ │ │ ├─css
│ │ │ ├─fonts
│ │ │ └─images
│ │ ├─components # vue components
│ │ ├─http # vue-resource configuration
│ │ ├─locale # vue-i18n configuration
│ │ ├─router # vue-router configuration
│ │ ├─socket # socket.io configuration
│ │ ├─storage # web storage api
│ │ ├─store # vuex store
│ │ │ └─modules
│ │ └─view # app pages
│ │ └─auth
│ └─static # static folder
└─server # backend server folder
├─api # backend api list
│ ├─thing
│ └─user
├─auth # user auth logical
│ └─local
├─components # server components
│ └─errors
├─config # server configs, contains express socket.io, etc.
└─views # server servered pages
Most of the configuration is concentrated in the config.js file, and most of them have explicit comments, you need to take a look at it first.
Here is some important/frequently-used configuration:
frontend.portport that frontend server listens atbackend.portport that backend server listen atbackend.secrets.sessionsecret for session, important when you deploy your app, make sure it's complex enoughbackend.mongo.urichange this if your mongodb uri is not matchedbackend.serverFrontendwhether to server the frontend code. If set totruethe express server servers the frontend code, otherwise you may need a http server like nginx to server frontend code and there is a nginx configuration atnginx.example.conf(default true)
When you deploy your app to you cloud server, it's easy to config you app with environment variable, here is the supported:
APP_portorPORT: set tobackend.portAPP_HOSTorAPP_IPorHOSTorIP: set tobackend.ipMONGODB_URIorMONGOHQ_URI: set tobackend.mongo.uriSECRET: set tobackend.secrets.session
The generated app is just a template to build your app system fast, maybe it can't meet your needs, so you need to do some change at this issue.
Under MIT license