use pnpm
This commit is contained in:
parent
f24c0d2078
commit
65192c6c72
16
README.md
16
README.md
@ -4,23 +4,23 @@ Content File Management Program.
|
|||||||
For study about nodejs, typescript and react.
|
For study about nodejs, typescript and react.
|
||||||
|
|
||||||
### deployment
|
### deployment
|
||||||
```
|
```bash
|
||||||
$ npm run app:build
|
pnpm run app:build
|
||||||
```
|
```
|
||||||
|
|
||||||
### test
|
### test
|
||||||
```
|
```bash
|
||||||
$ npm run app
|
$ pnpm run app
|
||||||
```
|
```
|
||||||
|
|
||||||
### server build
|
### server build
|
||||||
```
|
```bash
|
||||||
$ npm run compile
|
$ pnpm run compile
|
||||||
```
|
```
|
||||||
|
|
||||||
### client build
|
### client build
|
||||||
```
|
```bash
|
||||||
$ npm run build
|
$ pnpm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc",
|
"compile": "tsc",
|
||||||
"compile:watch": "tsc -w",
|
"compile:watch": "tsc -w",
|
||||||
"build": "cd src/client && npm run build:prod",
|
"build": "cd src/client && pnpm run build:prod",
|
||||||
"build:watch": "cd src/client && npm run build:watch",
|
"build:watch": "cd src/client && pnpm run build:watch",
|
||||||
"app": "electron build/app.js",
|
"app": "electron build/app.js",
|
||||||
"app:build": "electron-builder",
|
"app:build": "electron-builder",
|
||||||
"app:pack": "electron-builder --dir",
|
"app:pack": "electron-builder --dir",
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -63,27 +63,33 @@ class ServerApplication{
|
|||||||
|
|
||||||
let diff_router = createDiffRouter(this.diffManger);
|
let diff_router = createDiffRouter(this.diffManger);
|
||||||
this.diffManger.register("comic",createComicWatcher());
|
this.diffManger.register("comic",createComicWatcher());
|
||||||
|
|
||||||
|
console.log("setup router");
|
||||||
|
|
||||||
let router = new Router();
|
let router = new Router();
|
||||||
router.use("/api/*", async (ctx,next)=>{
|
router.use("/api/(.*)", async (ctx,next)=>{
|
||||||
//For CORS
|
//For CORS
|
||||||
ctx.res.setHeader("access-control-allow-origin", "*");
|
ctx.res.setHeader("access-control-allow-origin", "*");
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
|
|
||||||
router.use('/api/diff',diff_router.routes());
|
router.use('/api/diff',diff_router.routes());
|
||||||
router.use('/api/diff',diff_router.allowedMethods());
|
router.use('/api/diff',diff_router.allowedMethods());
|
||||||
|
|
||||||
|
const content_router = getContentRouter(this.documentController);
|
||||||
|
router.use('/api/doc',content_router.routes());
|
||||||
|
router.use('/api/doc',content_router.allowedMethods());
|
||||||
|
|
||||||
|
const tags_router = getTagRounter(this.tagController);
|
||||||
|
router.use("/api/tags",tags_router.allowedMethods());
|
||||||
|
router.use("/api/tags",tags_router.routes());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.serve_with_meta_index(router);
|
this.serve_with_meta_index(router);
|
||||||
this.serve_index(router);
|
this.serve_index(router);
|
||||||
this.serve_static_file(router);
|
this.serve_static_file(router);
|
||||||
|
|
||||||
const content_router = getContentRouter(this.documentController);
|
|
||||||
router.use('/api/doc',content_router.routes());
|
|
||||||
router.use('/api/doc',content_router.allowedMethods());
|
|
||||||
|
|
||||||
const tags_router = getTagRounter(this.tagController);
|
|
||||||
router.use("/api/tags",tags_router.allowedMethods());
|
|
||||||
router.use("/api/tags",tags_router.routes());
|
|
||||||
|
|
||||||
const login_router = createLoginRouter(this.userController);
|
const login_router = createLoginRouter(this.userController);
|
||||||
router.use('/user',login_router.routes());
|
router.use('/user',login_router.routes());
|
||||||
@ -102,6 +108,7 @@ class ServerApplication{
|
|||||||
});}
|
});}
|
||||||
app.use(router.routes());
|
app.use(router.routes());
|
||||||
app.use(router.allowedMethods());
|
app.use(router.allowedMethods());
|
||||||
|
console.log("setup done");
|
||||||
}
|
}
|
||||||
private serve_index(router:Router){
|
private serve_index(router:Router){
|
||||||
const serveindex = (url:string)=>{
|
const serveindex = (url:string)=>{
|
||||||
@ -204,8 +211,8 @@ class ServerApplication{
|
|||||||
}
|
}
|
||||||
start_server(){
|
start_server(){
|
||||||
let setting = get_setting();
|
let setting = get_setting();
|
||||||
console.log("start server");
|
|
||||||
//todo : support https
|
//todo : support https
|
||||||
|
console.log(`listen on http://${setting.localmode ? "localhost" : "0.0.0.0"}:${setting.port}`);
|
||||||
return this.app.listen(setting.port,setting.localmode ? "127.0.0.1" : "0.0.0.0");
|
return this.app.listen(setting.port,setting.localmode ? "127.0.0.1" : "0.0.0.0");
|
||||||
}
|
}
|
||||||
static async createServer(){
|
static async createServer(){
|
||||||
|
Loading…
Reference in New Issue
Block a user