Add the logRequestType function as a server middleware

You should only make changes to server.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


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

const port = 8080;

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


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


import express from 'express';

const server = express();

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

export { server };