Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shubham-chhimpa-here/abstract_help_center
A RESTful API for managing and searching cards in a help center. Built with Node.js and Express.js, this application uses Mongoose for MongoDB interactions. Features include endpoints for creating, retrieving, updating, and searching cards by title. Ideal for learning and building CRUD operations with a NoSQL database.
https://github.com/shubham-chhimpa-here/abstract_help_center
api crud expressjs javascript mongodb mongoose nodejs nosql operations restful
Last synced: 3 months ago
JSON representation
A RESTful API for managing and searching cards in a help center. Built with Node.js and Express.js, this application uses Mongoose for MongoDB interactions. Features include endpoints for creating, retrieving, updating, and searching cards by title. Ideal for learning and building CRUD operations with a NoSQL database.
- Host: GitHub
- URL: https://github.com/shubham-chhimpa-here/abstract_help_center
- Owner: shubham-chhimpa-here
- Created: 2024-08-29T03:13:41.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-08-29T11:25:34.000Z (4 months ago)
- Last Synced: 2024-10-11T04:01:27.861Z (3 months ago)
- Topics: api, crud, expressjs, javascript, mongodb, mongoose, nodejs, nosql, operations, restful
- Language: JavaScript
- Homepage: https://abstract-help-center.onrender.com/
- Size: 61.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Here's an example `README.md` file for your Node.js and Express application that includes setting up the environment, running the application, and using the API:
# Card Help Center API
This is a simple API for managing cards in a help center. The API is built using Node.js, Express.js, and MongoDB (with Mongoose ORM). It includes endpoints for creating, retrieving, and searching cards based on their titles.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [API Endpoints](#api-endpoints)
- [Environment Variables](#environment-variables)## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/shubham-chhimpa-here/Abstract_help_center.git
cd Abstract_help_center
```2. **Install dependencies:**
Make sure you have [Node.js](https://nodejs.org/) and [npm](https://www.npmjs.com/) installed.
```bash
npm install
```3. **Set up environment variables:**
Copy the `.env.example` file to `.env` and fill in the required environment variables.
```bash
cp .env.example .env
```Then, open `.env` and fill in your specific values:
```dotenv
DB_URI=mongodb://localhost:27017/yourDatabaseName
PORT=3000
```4. **Start the server:**
```bash
npm run dev
```The server will start on the port specified in your `.env` file (default is `3000`).
## Usage
### Running the Application
- To start the application in development mode:
```bash
npm run dev
```- To start the application in production mode:
```bash
npm run start
```The API will be accessible at `http://localhost:3000` by default.
### MongoDB Connection
Make sure MongoDB is installed and running on your machine, or use a cloud-based MongoDB service like [MongoDB Atlas](https://www.mongodb.com/cloud/atlas). Update the `DB_URI` in the `.env` file with your MongoDB connection string.
## API Endpoints
### 1. Check Server Status
- **Endpoint**: `GET /ping`
- **Description**: Checks if the server is running.
- **Response**: `pong`### 2. Create a Card
- **Endpoint**: `POST /cards`
- **Description**: Creates a new card in the help center.
- **Body Parameters**:
- `title` (string): The title of the card.
- `description` (string): A brief description of the card.
- **Response**: The created card object.### 3. Get All Cards
- **Endpoint**: `GET /cards`
- **Description**: Retrieves a list of all cards.
- **Response**: An array of card objects.### 4. Get a Card by Title
- **Endpoint**: `GET /cards/:title`
- **Description**: Retrieves the details of a specific card by its title.
- **Response**: The card object with the specified title.### 5. Search Cards by Title
- **Endpoint**: `GET /cards/search?searchString=yourSearch`
- **Description**: Searches for cards that contain all words in the `searchString` in their title.
- **Response**: An array of matching card objects.## Environment Variables
The following environment variables need to be set in your `.env` file:
- `DB_URI`: The MongoDB connection string.
- `PORT`: The port on which the server will run (default: 3000).Example `.env` file:
```dotenv
DB_URI=mongodb://localhost:27017/yourDatabaseName
PORT=3000
```### Key Sections Explained:
1. **Installation**: Guides users through cloning the repository, installing dependencies, setting up environment variables, and starting the server.
2. **Usage**: Provides instructions for running the application in different modes.
3. **API Endpoints**: Documents the available API routes, including methods, descriptions, required parameters, and expected responses.
4. **Environment Variables**: Lists required environment variables and explains their purpose, along with an example.