Difference between express and socketio for nodejs

Socket io and express is complete different. But new beginners get confused because in most of the online tutorials people used application server as express and bidirectional communication channel as Socketio. And they put both the code in a same server.js file. Lets take below example (Code copied from a famous online tutorial):

const express = require("express");
const app = express();

const port = 3000;
const http = require('http').createServer();

app.use(require('cors')());
const io = require("socket.io")(http, {
   cors: {
       origin: "*",
       methods: ["GET", "POST"]
   }
})
http.listen(port,()=>{
   console.log("server is running on "+port);
})

After reading this code a new node learner will easily get confused.
So It is not required to put both together. for example just remove the express codes from the above code example and still the socketio server will run perfectly.

const port = 3000;
const http = require('http').createServer();

const io = require("socket.io")(http, {
   cors: {
       origin: "*",
       methods: ["GET", "POST"]
   }
})
http.listen(port,()=>{
   console.log("server is running on "+port);
})

I do not use express. I personally like Apache as my application server. So you can use any application server separately which will handle your static requests and work as web server.