0

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....

1
  • For learning you could do this yourself. But I really advice you to use something like express for the rest of your projects because it is just simply the best and I do not think you will be able to create anything better yourself. Commented Aug 31, 2012 at 7:45

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Hey thanks for your advice....no its not a school assignment. I am in fact building a enterprise level support system and want to keep any third party plugins/frameworks/modules at bay and want to have everything developed in-house.....can you tell me how to get started with studying of source code? thanks.
In that case you'll want to look at the connect source, since express pretty much delegates all session management to connect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.