7 examples of 'npm start port' in JavaScript

Every line of 'npm start port' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
21async start(port: number): Promise<boolean> {
22 this.runningState = APIRunningState.STARTING;
23 console.log(`listen to ${port}`);
24 this.runningState = APIRunningState.RUNNING;
25 return true;
26}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

44async function start({
45 port,
46 https,
47 onlisten
48} = {}) {
49 const app = new _application.default();
50 app.useAll();
51 withHttps.call(app, https);
52 port = await detectPort(port);
53 return new Promise((rs, rj) => {
54 app.listen(port, err => {
55 if (err) throw err;
56
57 if ((0, _utils.getArgType)(onlisten).isFunction) {
58 onlisten.call(app, port);
59 } // callback app for supertest
60
61
62 rs(port, app);
63 });
64 });
65}
5async start() {
6 // optional. write file header if needed.
7 console.log('start');
8 await this.dest.write(header);
9}
23function startServer() {
24 const initialServerPort =
25 parseInt(program.port, 10) || process.env.PORT || 3000;
26 const host = program.host || 'localhost';
27 const promise = portFinder
28 .getPortPromise({port: initialServerPort})
29 .then(port => {
30 server(port, host);
31 const {baseUrl} = require(`${CWD}/siteConfig.js`);
32 const serverAddress = `http://${host}:${port}${baseUrl}`;
33 console.log('Docusaurus server started on port %d', port);
34 openBrowser(serverAddress);
35 });
36 return promise;
37}
39public start(port: number): void {
40 this.app.get('*', (req, res) => {
41 res.send(this.SERVER_STARTED + port);
42 });
43 this.app.listen(port, () => {
44 Logger.Imp(this.SERVER_STARTED + port);
45 });
46}
3export function check(port: number) {
4 return new Promise(fulfil => {
5 const server = net.createServer();
6
7 server.unref();
8
9 server.on('error', () => {
10 fulfil(false);
11 });
12
13 server.listen({ port }, () => {
14 server.close(() => {
15 fulfil(true);
16 });
17 });
18 });
19}
50function start (name) {
51 if (name == 'main') {
52 roles[name]();
53 } else {
54 net.createServer(function(con) {
55 con.on('error', noop);
56 con.pipe(roles[name]()).pipe(con);
57 }).listen(ports.register({
58 role: name,
59 host: 'localhost'
60 }));
61 }
62}

Related snippets