Exam4Training

Which code should be inserted at the line 03 to set up an event and start the web server?

Refer to the code below:

01 const server = require(‘server’);

02 /* Insert code here */

A developer imports a library that creates a web server. The imported library uses events and callbacks to start the servers

Which code should be inserted at the line 03 to set up an event and start the web server?
A . Server.start ();
B . server.on(‘ connect ’, (port) => {console.log(‘Listening on ’, port) ;})
C . server()
D . serve(( port) => (
E . console.log( ‘Listening on ’, port) ;

Answer: B

Exit mobile version