Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions backend.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
### Assignment Description:
# Help Center Backend API

This repository contains the backend API for the Help Center application, built using Node.js, Express.js, and MongoDB. This API allows users to manage Help Center cards, including adding, updating, retrieving, and deleting help center topics.

## Table of Contents

- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Environment Variables](#environment-variables)
- [Running the Application](#running-the-application)
- [API Endpoints](#api-endpoints)
- [Folder Structure](#folder-structure)



## Getting Started

These instructions will help you set up the project on your local machine for development and testing purposes.


### Installation

1. **Clone the repository:**

```bash
git clone https://github.com/your-username/help-center-backend.git
cd backend
npm install
npm run start



<!-- ### Assignment Description:

**Title:** Build a Help Center API

Expand Down Expand Up @@ -31,4 +64,4 @@ The objective of this assignment is to create a RESTful API that allows users to

### Submission:
- Provide the source code in a GitHub repository and on the submission of the form, paste the github link.
- Include a README file with instructions on how to set up and run the project locally.
- Include a README file with instructions on how to set up and run the project locally. -->
24 changes: 24 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.env

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
23 changes: 23 additions & 0 deletions backend/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const express = require('express');
const dotenv = require('dotenv');
const cardRoutes = require('./src/routes/cardRoutes');
const connectDB = require('./src/config/db');
const cors = require("cors")

dotenv.config();
connectDB();

const app = express();

app.use(express.json());
app.use(cors())
app.use('/api/cards', cardRoutes);

app.get('/ping', (req, res) => {
res.status(200).json({ message: 'Server is running' });
});

const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});
Loading