This is the web project for N9E
The built pub folder can work in the n9e.
you can deploy the front-end code independently, just replace the pub with the new release.
node: v16.x <= v16.15.0
npm: 8.x <= 8.5.5
npm install
npm run dev
The back-end api proxy config is https://github.com/n9e/fe/blob/main/vite.config.ts#L41
Trouble shooting: https://answer.flashcat.cloud/questions/10010000000003759
💡 Dev locale switching
To speed up the dev server, only Chinese (zh_CN) locale files are loaded by default in development mode; other languages are replaced with empty objects to reduce unnecessary module requests.
To switch to another language, create a.envfile in the project root and set theVITE_DEV_LOCALEenvironment variable:# .env VITE_DEV_LOCALE=en_USOr specify it inline when starting the dev server:
VITE_DEV_LOCALE=en_US npm run devSupported locales:
zh_CN,en_US,zh_HK,ru_RU,ja_JP.
This optimization only applies to theservephase; production builds are unaffected.
npm run build
server {
listen 8765;
server_name _;
add_header Access-Control-Allow-Origin *;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
root front-end/page/path; # e.g. /root/n9e/pub;
location / {
root front-end/page/path; # e.g. /root/n9e/pub;
try_files $uri /index.html;
}
location /api/ {
proxy_pass http://n9e.api.server; # e.g. 127.0.0.1:18000
}
}
vite.config.jsandtsconfig.jsonshould both configure to make sure alias works- Add
"css.validate": falsein vscode setting.json to ignore the css warning - Install the Prettier plugin in vscode and set the format on save