By the holiday period will nodejs re-review and play a bit sketch to design the interface, very good. (Note: The code is collated and placed on GitHub, please follow.) )
This chat room I gave it a definition of a name called "Secret chat room".
Requirements :
Technology Selection :
Backend: Nodejs,socket.io, Middleware (EXPRESS,BODY-PARSER,MULTER,EJS), Mongoose
Express: Is the Nodejs Web application framework, mainly to understand its router
Body-parser: Used to get the parameter values in the REQ
Multer: For uploading files
Ejs: for template rendering
Mongoose: Connecting the Mongoose Database
Database: MongoDB
Front End: Bootstrap layout, Vuejs for bidirectional binding, request or use of jquery Ajax, unused fetch (mainly bootstrap is based on jquery, So no use of webpack or browerify and other packaging tools for processing fetch).
Implementation :
1. Create a Web server
2, identity authentication, which routes to be identity processing.
4. Database Configuration
5. Define the data model
6, user registration, Login
7, establish Socket.io
8, the front-end code is relatively simple, no no is a few requests, the following only intercept the front-end Socke.io part.
Operating effect :
1. Login
2. Main interface
3. Create a room (create your own topic of interest)
3. Simulate two users
4, each room mouse move to show room content
5, join the room, will prompt who joins
6, exit the room, the same will be prompted, the room between the non-impact.
7. Message
There are still unfinished parts at this stage. such as the preservation of messages, personnel picture, collection and so on.
Subsequently, it is hoped that the NODEJS message processing can be made into a generic component that can be easily invoked in any system after the message center is installed.
Finally, a piece of sketch design.
Secret room chat room based on Nodejs