Skip to content

TariqTechie-dev/rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quora-Inspired REST API 🚀

A full-stack web application built to understand the fundamentals of RESTful architecture, CRUD operations, and server-side rendering. This project simulates a simple social media platform where users can create, read, update, delete, and search posts.

🌟 Features

  • Full CRUD Operations: Create, Read, Update, and Delete posts seamlessly.
  • Search Functionality: Filter posts by username for easy discovery.
  • Timestamps: Display real-time creation dates for posts.
  • Unique IDs: Secure post identification using UUID.
  • RESTful Routes: Follow standard API design patterns for clean and intuitive endpoints.
  • Responsive UI: Styled with CSS for a user-friendly interface.

🛠️ Tech Stack

  • Backend: Node.js, Express.js
  • Frontend: EJS (Embedded JavaScript templates), CSS
  • Tools: Method-Override, UUID, Path, Date-fns

📋 Prerequisites

  • Node.js (version 14 or higher)
  • npm (Node Package Manager)

🚀 Installation

  1. Clone the repository:

    git clone <your-repository-link>
    cd rest-class
  2. Install dependencies:

    npm install

🏃‍♂️ Running the Application

Start the server:

node index.js

The application will be running at http://localhost:3000.

Navigate to http://localhost:3000/posts to view and interact with posts.

📖 Usage

  • View Posts: Visit the home page to see all posts.
  • Create Post: Click "Create new post" to add a new entry.
  • Edit Post: Use the "Edit" link on any post to modify it.
  • Delete Post: Click "Delete" to remove a post.
  • Search: Use the search bar to filter posts by username.

🔌 API Endpoints

Method Endpoint Description
GET /posts Get all posts
GET /posts/new Show create post form
POST /posts Create a new post
GET /posts/:id Get a specific post
PATCH /posts/:id Update a specific post
GET /posts/:id/edit Show edit post form
DELETE /posts/:id Delete a specific post
GET /search Search posts by username

📁 Project Structure

rest-class/
├── index.js              # Main application file
├── package.json          # Dependencies and scripts
├── README.MD             # Project documentation
├── public/               # Static assets (CSS, images)
│   └── style.css
├── views/                # EJS templates
│   ├── index.ejs
│   ├── show.ejs
│   ├── edit.ejs
│   ├── form.ejs
│   └── includes/
│       └── head.ejs
└── notes/                # Additional notes (not part of app)

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the ISC License.

👤 Author

Tariq Hussain

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors