- A Single Page Application based on hash
- Vanilla JS(No Vue, Angular, React, JQuery)
Install all packages
npm install
Start express server
npm run watch
Start front-end resource server (support hot module reload)
npm start
Build front-end resource to deploy (no need when develop)
npm run build
Open localhost:3000 in browser
.
├── README.md
├── dist
│ ├── app.js
│ └── index.html
├── index.html Main Page
├── package-lock.json
├── package.json
├── server Express Server
│ └── index.js
├── src All Front-end Resource
│ ├── index.js Front-end main
│ ├── index.less All Style
│ ├── js js functions
│ │ ├── serverInfo.js
│ │ ├── initRouter.js
│ │ └── register.js
│ └── view Different Pages
│ ├── about.html
│ ├── chatList.html
│ ├── error.html
│ ├── login.html
│ └── register.html
├── webpack-dev-server.js Webpack dev server config
└── webpack.config.js Webpack config
- Keep *.html pure, do not bind eventListener in *.html or add stylesheet, the webpack loader do not support this, please refer to js/register.js to see how to bind eventListener
- You can use Less (http://lesscss.org/) to write stylesheet:
- We use Navigo (https://github.com/krasimir/navigo#readme) as our router library, if you want to add a new page, please see examples in index.js
- You can use import and require in front-end, in node server side, you can only use require.
- If you want to learn more about webpack, you can read the guides (https://webpack.js.org/guides/)