This is a web application built using Node.js, MongoDB, and Express.js. It features user authentication with login and registration functionality, along with a contact form for users to send messages.
Before running this application, make sure you have the following installed:
- Node.js
- MongoDB
- Clone this repository to your local machine or download the source code as a ZIP file.
- Navigate to the project's root directory.
- Install the dependencies by running the following command:
npm installnpm initnpm install passport
npm install express
npm install mongoose
npm install body-parser
npm install passport-local
npm install passport-local-mongoose
npm install express-session
npm install ejs
- Set up the MongoDB connection by replacing the MongoDB URL in
App.jswith your own database URL.
- Create a MongoDB database for the application.
- Define the required schemas in your MongoDB database based on the following models used in the application:
-
User Schema:
- Username (String)
- Email (String)
- Password (String)
-
Product Schema:
- Define the fields based on your specific product requirements.
-
Ticket Schema:
- Name (String)
- Email (String)
- Message (String)
Ensure that the database and collection names used in the application match the ones you have set up in your MongoDB database.
- Start the application by running the following command:
node App.js- Open your web browser and go to
http://localhost:3000to access the application.
- User Authentication: Users can register an account and log in using their credentials.
- Contact Us Form: Users can send messages through the contact form.
- Product Listing: Users can view a list of products.
- User Management: Administrators can manage user accounts by deleting and updating email addresses.
App.js: The main entry point of the application.model/User.js: Defines the User model for user authentication.model/Products.js: Defines the Products model for storing product information.model/ticket.js: Defines the Ticket model for storing contact form messages.views/: Contains the EJS templates for rendering the different pages.public/: Contains static assets such as CSS stylesheets and client-side JavaScript files.
