Creating session mechanism with core nodejs

I am trying to create a complete session managment in nodejs for logins, chat sessions etc. I googled a lot and every solution that i got was with some framework/module. I don't want to use any module/framework. I would rather like to build my own solution for this:

So this is the plan:

  1. I will set a session cookie on the client machine (yet to figure out how)
  2. For each cookie, i will be maintaining a unique id in the database instead of files as is the case with php (i am using mongodb)
  3. When a user opens the application, a cookie will be set, a entry will be made in database and corresponding information from the db will be fetched.

I am yet to lay a concrete plan for this. I wanted to know whether doing it this way is a good idea? i read somewhere....'Real men don't use any framework. They make everything on their own' :P

Please correct me if i am on a wrong direction. M just starting with these things....

I'm not aware of any node.js frameworks that are closed-source. Just pick one that seems to do what you want to do, download it, and study the source code to see how the developer implemented it. Then come up with your (perceived) improvement on how they did it. You'll probably find that implementing session management involves a whole bunch of nitpicky details that were never obvious to you.

Ignore all the above advice if this is a school assignment where you're not allowed to look at related code. If that's the case, I pity you because you have an incompetent teacher.