Implement the function logRequestTimestamp and use it as middleware.

The function logRequestTimestamp should print the current date and time to the screen in UTC format, i.e. Mon, 23 Nov 3027 10:15:26 GMT.
You can get the current date and time the function getFormattedDate from functions.js.

This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task

functions.js

export const getFormattedDate = (date) => {
  if (date) {
    return date.toUTCString();
  }
  return new Date().toUTCString();
}

index.js

import { server } from './server.js';

const port = 8080;

server.listen(port, () => {
  console.log(`Server is running on ${port}`);
});

middleware.js

export const logRequestTimestamp = () => {
  console.log('Mon, 23 Nov 3027 10:15:26 GMT');
}

export const logRequestType = (req, res, next) => {
  console.log(`Received ${req.method} request`);
  next();
}

server.js

import express from 'express';

import { logRequestType } from './middleware.js';

const server = express();

server.use(logRequestType);

server.get('/', (req, res) => {
  res.send('Learning to use middleware!');
})

export { server };