Update dev guideline

This commit is contained in:
Louis Lam 2022-04-26 02:20:13 +08:00
parent 4114f43b48
commit 94ada36dfa

View file

@ -79,7 +79,7 @@ I personally do not like something need to learn so much and need to config so m
- 4 spaces indentation
- Follow `.editorconfig`
- Follow ESLint
- Methods and funtions should be documented with JSDoc
- Methods and functions should be documented with JSDoc
## Name convention
@ -90,9 +90,10 @@ I personally do not like something need to learn so much and need to config so m
## Tools
- Node.js >= 14
- NPM >= 8.5
- Git
- IDE that supports ESLint and EditorConfig (I am using IntelliJ IDEA)
- A SQLite tool (SQLite Expert Personal is suggested)
- A SQLite GUI tool (SQLite Expert Personal is suggested)
## Install dependencies
@ -100,39 +101,42 @@ I personally do not like something need to learn so much and need to config so m
npm ci
```
## How to start the Backend Dev Server
## Dev Server
(2021-09-23 Update)
(2022-04-26 Update)
We can start the frontend dev server and the backend dev server in one command.
Port `3000` and port `3001` will be used.
```bash
npm run start-server-dev
npm run dev
```
It binds to `0.0.0.0:3001` by default.
## Backend Server
### Backend Details
For development, it binds to `0.0.0.0:3001` by default.
For production, it binds to `0.0.0.0:3000` by default.
It is mainly a socket.io app + express.js.
express.js is just used for serving the frontend built files (index.html, .js and .css etc.)
### Structure in /server/
- model/ (Object model, auto mapping to the database table name)
- modules/ (Modified 3rd-party modules)
- notification-providers/ (individual notification logic)
- routers/ (Express Routers)
- socket-handler (Socket.io Handlers)
- server.js (Server main logic)
- server.js (Server entry point and main logic)
## How to start the Frontend Dev Server
## Frontend Dev Server
1. Set the env var `NODE_ENV` to "development".
2. Start the frontend dev server by the following command.
It binds to `0.0.0.0:3000` by default. Frontend dev server is used for development only.
```bash
npm run dev
```
It binds to `0.0.0.0:3000` by default.
For production, it is not used. It will be compiled to `dist` directory instead.
You can use Vue.js devtools Chrome extension for debugging.