Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wait( sleep ) {
- return new Promise( ( resolve , reject ) => {
- setTimeout( () => {
- resolve();
- } , sleep );
- } );
- }
- async index( req , res ) {
- await wait( 1000 );
- console.log( 'a' );
- await wait( 2000 );
- console.log( 'b' );
- await wait( 3000 );
- console.log( 'c' );
- await wait( 4000 );
- console.log( 'd' );
- res.send( 'Hello world!' );
- }
Advertisement
Add Comment
Please, Sign In to add comment