Skip to content

Mango Messenger is a messaging application built with Node.js, Express.js, and PostgreSQL. It allows users to create accounts, log in, send messages, and view their messages. The application provides an intuitive user interface, ensuring seamless communication between users.

License

Notifications You must be signed in to change notification settings

njokoth/redmangomsg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Mango Messenger project is a messaging application that allows users to create accounts, log in, send messages, and view their messages. The project consists of both client-side and server-side code.

Client-Side: The client-side code includes HTML, CSS, and JavaScript that create the user interface for the messaging application.

  1. Account Creation: The account creation page allows users to create an account by providing their full name, username, password, and confirming the password. The client-side JavaScript code validates the form input and sends a POST request to the server to create the account.

  2. Login: The login page provides a form where users can enter their username and password to log into their Mango Messenger account. The client-side JavaScript code sends a POST request to the server with the login credentials and displays an alert indicating the success or failure of the login attempt.

  3. Sending Messages/Viewing Messages: The content page allows users to send messages to other users and view their own messages. The user can enter the sender's username, recipient's username, and the message text in a form. The JavaScript code sends a POST request to the server to send the message and updates the message display area with the received messages. The page also includes a sign-out button to log out the user.

Server-Side: The server-side code is implemented using Node.js, Express.js, and PostgreSQL to handle the backend functionality of the messaging application.

  1. Dependencies: The server-side code requires several dependencies, including Express.js, CORS, body-parser, pg, and Pool, to handle routing, middleware, and database interactions.

  2. Express Application: An Express application is created, and the necessary middleware for handling request bodies and enabling CORS is set up.

  3. PostgreSQL Connection Pool: A PostgreSQL connection pool is created to establish a connection with the PostgreSQL database.

  4. Account Creation: A route is defined to handle the creation of user accounts. It receives a POST request with user details, validates the input, and inserts the user data into the PostgreSQL database.

  5. Login: A route is defined to handle user login. It receives a POST request with login credentials, checks the credentials against the database, and responds with the result.

  6. Sending a Message: A route is defined to handle sending messages. It receives a POST request with the sender's username, recipient's username, and message text. It validates the recipient's username and inserts the message data into the PostgreSQL database.

  7. Fetching User Messages: A route is defined to fetch user messages. It receives a GET request with the recipient's username as a query parameter and retrieves the corresponding messages from the PostgreSQL database.

  8. Server Initialization: The server is started and listens on port 3000.

The combination of the client-side and server-side code enables users to create accounts, log in, send messages, and view their messages within the Mango Messenger application.

About

Mango Messenger is a messaging application built with Node.js, Express.js, and PostgreSQL. It allows users to create accounts, log in, send messages, and view their messages. The application provides an intuitive user interface, ensuring seamless communication between users.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages