-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core and app): 新增软件服务端,使脚本可读取软件信息。
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
import express from 'express'; | ||
import Store from 'electron-store'; | ||
import getPort from 'get-port'; | ||
import { Logger } from '../logger'; | ||
const logger = Logger('server'); | ||
|
||
export async function startupServer() { | ||
const app = express(); | ||
const store = new Store(); | ||
|
||
app.get('/setting', (req, res) => { | ||
res.json(store.store.setting); | ||
}); | ||
|
||
const port = await getPort({ port: [15319, 153120, 15321] }); | ||
|
||
app.listen(port, () => { | ||
logger.info('服务启动成功,端口:', port); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters