examples/mongodb/server.js
/** Starts a HTTP server that receives requests on sample server port. */
Starts a HTTP server that receives requests on sample server port.
Starts a HTTP server that receives requests on sample server port .
function startServer(port) {
  MongoClient.connect(url, (err, database) => {
    if (err) throw err;
    db = database.db('mydb');
  });
  const server = http.createServer(handleRequest);
  server.listen(port, (err) => {
    if (err) {
      throw err;
    }
    console.log(`Node HTTP listening on ${port}`);
  });
}
function startServer ( port ) { MongoClient . connect ( url , ( err , database ) => { if ( err ) throw err ; db = database . db ( 'mydb' ) ; } ) ; const server = http . createServer ( handleRequest ) ; server . listen ( port , ( err ) => { if ( err ) { throw err ; } console . log ( ` ${ port } ` ) ; } ) ; }
Starts a HTTP server that receives requests on sample server port.
Starts a HTTP server that receives requests on sample server port .
// Connect to db // Creates a server // Starts the server