Express JS
Express JS
INTRODUCTION TO EXPRESS JS
WHY EXPRESS IS USED OVER NODE JS ?
JavaScript is a fast, unopinionated, minimalist web framework for Node. js that provides a
robust set of features for web and mobile applications. It has many advantages, such as
simplicity, flexibility, community support, scalability, and cross-platform functionality.
Run-time platform or
Framework/Platform Framework based on Node JS environment designed for server-
side execution of JavaScript.
Coding time It requires less coding time. It requires more coding time.
2
Get Request Limit => Most servers and clients have a limit of 8192 bytes (8 KB), which is usually
configurable somewhere in the server or client settings.
2.Post Request
Post method facilitates you to send large amount of data because data is send in the body. Post
method is secure because data is not visible in URL bar but it is not used as popularly as GET
method. On the other hand GET method is more efficient and used more than POST.
5
C HAINING OF REQUEST
https://youtu.be/SksvlZM-5Sk?si=lYvIArX_XxeOPUWW
M IDDLEWARE FUNCTIONS
6
Middleware functions are functions that have access to the request object (req), the response
object (res), and the next function in the application’s request-response cycle.
The next function is a function in the Express router which, when invoked, executes the
middleware succeeding the current middleware.
So, when a request is made to your Express server, Express will first check if the requested URL
matches a file in the specified directory (public), and if so, it will serve that file. If not, it will
continue to the next middleware or route handler in the chain. This middleware is commonly
used to serve static assets like HTML, images, CSS, and client-side JavaScript files, making them
accessible to clients when they access your web application.
If the current middleware function does not end the request-response cycle, it must
call next() to pass control to the next middleware function. Otherwise, the request will be left
hanging.
9