mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-05-17 17:49:23 +08:00
9 lines
261 B
JavaScript
9 lines
261 B
JavaScript
import portfinder from 'portfinder';
|
|
|
|
export default async function getPort(userPort) {
|
|
const defaultPort = process.env.PORT || userPort;
|
|
return portfinder.getPortPromise({
|
|
port: defaultPort ? parseInt(String(defaultPort), 10) : 8000,
|
|
});
|
|
}
|