This project is a simple website manager built with Express, MySQL, and EJS, allowing you to create and manage blog posts and handle contact form submissions.
Ensure you have the following installed on your system:
- Node.js
- MySQL
-
Clone the repository:
git clone https://github.com/peppervikes/Vikalp_IBM_Task.git cd Vikalp_IBM_Task -
Install necessary packages:
npm init -y npm install express mysql ejs body-parser npm install -D nodemon
-
Create the database:
CREATE DATABASE website_manager;
-
Use the database:
USE website_manager;
-
Create the
blog_poststable:CREATE TABLE blog_posts ( id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255) NOT NULL, content TEXT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-
Create the
contact_requeststable:CREATE TABLE contact_requests ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, message TEXT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
- Open the
server.jsfile. - Update the MySQL
userandpasswordwith your own credentials.
To start the website, run the following command in the terminal:
npm run dev