完成协议开发
This commit is contained in:
parent
00de726082
commit
8176e9c034
@ -4,7 +4,6 @@ const ukey = require("./FakeUKey")
|
||||
const cors = require('cors');
|
||||
const { killPortProcess } = require('kill-port-process');
|
||||
|
||||
|
||||
const app = express();
|
||||
// const port = 3000;
|
||||
const port = 8090;
|
||||
@ -47,18 +46,19 @@ app.post('/do', (req, res) => {
|
||||
|
||||
|
||||
(async () => {
|
||||
// long running process running on a given port(s), e.g. a http-server
|
||||
// takes a number, number[], string or string[]
|
||||
// single port
|
||||
await killPortProcess(8090);
|
||||
|
||||
try {
|
||||
await killPortProcess(port);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
app.listen(port, () => {
|
||||
app.listen(port, "127.0.0.1", () => {
|
||||
console.log(`Server is running on port ${port}`);
|
||||
}).on('error', (err) => {
|
||||
if (err.code === 'ECONNREFUSED') {
|
||||
console.log('端口监听失败。');
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user