A full-stack blog application where users can create, read, update, and delete posts. Built with Node.js, Express, and EJS — backed by a PostgreSQL database so data persists across server restarts.
- Create, read, update, and delete blog posts
- Posts stored in PostgreSQL — data survives server restarts
- Responsive UI built with Bootstrap 5 and custom CSS
| Layer | Technology |
|---|---|
| Runtime | Node.js |
| Framework | Express.js |
| Templating | EJS |
| Database | PostgreSQL |
| DB Client | node-postgres (pg) |
| Styling | Bootstrap 5 + Custom CSS |
- Node.js v18+
- PostgreSQL installed and running
git clone https://github.com/NitinMoturu72/Blog-Web-Application.git
cd blogopianpm installOpen psql and run:
CREATE DATABASE blogpost;
\c blogpost
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);Create a .env file in the root directory:
DBUSER=postgres
DBHOST=localhost
DATABASE=yourt_DB_name
DBPASSWORD=your_password
DBPORT=5432
node index.jsVisit http://localhost:3000
├── public/
│ └── styles/
│ └── main.css # Custom styles
├── views/
│ ├── partials/
│ │ ├── header.ejs
│ │ └── footer.ejs
│ ├── index.ejs # Home page — post list
│ ├── blog.ejs # Single post view
│ ├── create.ejs # Create / edit form
│ ├── about.ejs
│ └── FAQ.ejs
├── index.js # Express server & routes
├── .env # Environment variables (not committed)
├── .gitignore
└── README.md
| Method | Route | Description |
|---|---|---|
| GET | / |
List all posts |
| GET | /createPost |
Show create form |
| POST | /post |
Create a new post |
| POST | /viewPost |
View a single post |
| POST | /editPost |
Show edit form |
| POST | /update |
Update a post |
| POST | /deletePost |
Delete a post |
Nitin Moturu