Skip to content

saurabhsubham113/expressjs

Repository files navigation

#q1. Create two middleware functions. Use one middleware before and another one after the route / (default route). Create one more middleware which needs to be called after “/user” route.

#q2. Which built-in middleware has to be used in Express to serve static files. Create an app which serves images which are downloaded and stored as static files.

#q3. Create a registration form for the user to register by entering his firstname. Check if the user is already registered, if so display welcome message (Welcome firstname!), if he is not registered, send him to the signup form.

#q4. Create a route called “/create” to set a new cookie. Let the cookie expire after 10s. Create another route called “/clear” to delete the cookie called name which you have already set in the route “/user”.

#q5. Using the session management, find out the number of times the client has sent requests. For the first request, let the response be “You have visited the page for the first time!!” and for the next requests, let the response be “You visited this page X times”.

About

some basic hands-on on expressjs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published