Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aayush-bhargav/blog-website
This blog website showcases the seamless integration of a custom-built API and EJS (Embedded JavaScript) templating engine to create a dynamic and interactive user experience. The project demonstrates how to build a full-stack web application using Node.js, Express, and PostgreSQL, while utilizing EJS for server-side rendering of HTML.
https://github.com/aayush-bhargav/blog-website
api axios blog ejs ejs-templates express full-stack middleware nodejs postgres postgresql rest-api
Last synced: 25 days ago
JSON representation
This blog website showcases the seamless integration of a custom-built API and EJS (Embedded JavaScript) templating engine to create a dynamic and interactive user experience. The project demonstrates how to build a full-stack web application using Node.js, Express, and PostgreSQL, while utilizing EJS for server-side rendering of HTML.
- Host: GitHub
- URL: https://github.com/aayush-bhargav/blog-website
- Owner: Aayush-Bhargav
- Created: 2024-07-28T11:12:47.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T11:52:06.000Z (3 months ago)
- Last Synced: 2024-09-29T07:21:07.680Z (about 1 month ago)
- Topics: api, axios, blog, ejs, ejs-templates, express, full-stack, middleware, nodejs, postgres, postgresql, rest-api
- Language: JavaScript
- Homepage:
- Size: 305 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blog Website
This is a very simple blog website that allows users to create, read, update, and delete blog posts. The project is built using Node.js, Express, PostgreSQL, and EJS for templating.
## Installation
Clone the repository
```
git clone https://github.com/Aayush-Bhargav/Blog-Website.git
cd Blog-Website
```
Install dependencies
```
npm install
```
## Set up PostgreSQL database1. Create a PostgreSQL database named `info`.
2. Create a `posts` table using the following SQL:
```
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
title VARCHAR(100) NOT NULL,
content TEXT NOT NULL,
author VARCHAR(30) NOT NULL,
date TIMESTAMPTZ NOT NULL
);
```## Set up Environment Variables
Run
```
cp sampleEnv.txt .env
```
and replace the required details.## Launch
Start the API server
```
nodemon index.js
```
Start the Backend server
```
nodemon server.js
```
Open your browser and navigate to http://localhost:3000.## Screenshots
### Home Page
![home page](screenshots/homePage.png)
### New Post
![new post page](screenshots/newPost.png)
### Edit Post
![edit post page](screenshots/editPost.png)## Usage
- **Home Page**: Displays a list of all blog posts.
- **New Post**: Click the "New Post" button to create a new blog post.
- **Edit Post**: Click the "Edit" link next to a post to edit it.
- **Delete Post**: Click the "Delete" link next to a post to delete it.## API Endpoints
- **GET /posts**: Retrieve all posts.
- **GET /posts/:id**: Retrieve a specific post by ID.
- **POST /posts**: Create a new post.
- **PATCH /posts/:id**: Update a specific post by ID.
- **DELETE /posts/:id**: Delete a specific post by ID.