A Vue.js project basic with vue 2.0, vue-router and vuex for server side rendering.
- Vue + vue-router + vuex working together
- Server-side data pre-fetching
- Client-side state & DOM hydration
- Preload / prefetch resource hints
- Route-level code splitting
- Codes can run with or without SSR.
- Lazy loading routes.
A detailed Vue SSR guide can be found here.
First, download or clone this project.
Then install npm or yarn packages via (npm | yarn) install
.
(npm or yarn) run dev
It's served by webpack-dev-server. I recommend developing in this mode at first. So you can focus on your view things, not bother with server side things.
When your pages look fine, then you step into SSR mode to check the server side is OK.
When you start the project, you can visit http://localhost:8100 or http://localhost:8200 to look around.
(npm or yarn) run build
(npm or yarn) run start
In production, instead of serving static assets by SSR server, you should setup a nginx to serve static assets for performance reason.
If you find bugs, please submit issues on github. Pull requests are welcome!
MIT