Express middleware

node v10.24.1
version: 1.0.0
endpointsharetweet
const express = require( 'express' ); const app = express(); // Our first middleware, logging out request. app.get( '/', ( request, response, next ) => { console.log( 'Got request', request ); next(); // Passing control to the next middleware. } ); // Our second middleware, sending response to the user. app.get( '/', ( request, response ) => { response.send( 'Hello World!' ); } ); app.listen( 3000 );
Loading…

no comments

    sign in to comment