This is a NodeJS/Express-based FAQ management system with multilingual support and Redis caching for improved performance.
β
Multilingual Support (English, Hindi, Bengali)
β
REST API with Caching (Redis for caching)
β
Dockerized (Easily run using Docker)
β
Unit Testing & Linting (chai/mocha, ESlint)
FAQ_Manager/
βββ Backend/
β βββ config/
β β βββ mongoDB.js # MongoDB connection
β β βββ redis.js # Redis connection
β βββ controllers/
β β βββ createFaq.js # FAQ CRUD operations
β β βββ deleteFaq.js
β β βββ getFaq.js
β β βββ getOneFaq.js
β βββ models/
β β βββ faq.js # FAQ MongoDB model
β βββ routes/
β β βββ faqRouter.js # API routes
β βββ middleware/
β β βββ getId.js # Middleware to get FAQ by Id
β βββ services/
β β βββ translate.js # Translation of question and answer
β βββ app.js # Express app setup
β βββ tests/
β β βββ faq.test.js # Unit tests
β βββ .env # Environment variables
β βββ Dockerfile
β βββ eslint.config.mjs
β βββ package-lock.json
β βββ package.json
βββ .gitignore
βββ .dockerignore
βββ docker-compose.yml
- Node.js
- Express.js
- MongoDB
- Redis
- Docker
Before you begin, ensure you have the following installed:
git clone https://github.com/sahil19-19/FAQ_Manager.git
cd FAQ_Manager
npm install
MONGO_URL="mongodb://localhost/faqdb"
PORT=3000
REDIS_URL="redis://localhost:6379"
If you are not using Docker, you would need to start Redis-server and MongoDB-server in your machine
- Redis
# To start redis-server in mac/ Linux
redis-server
# For Windows users need to install WSL and install redis, and then run the above command
- MongoDB MongoDB is run as a service in Windows and doesn't need to be stated/stopped manually For linux (eg arch)
systemctl start mongodb.service
npm run dev # To run using nodemon
node app.js # To run simply
If you prefer to use Docker, run:
docker-compose up
in FAQ_Manager folder
Access the application at http://localhost:3000
.
# Get FAQs in English (default)
GET /api/faqs/
# Get FAQs in Hindi
GET /api/faqs/?lang=hi
# Get FAQs in Bengali
GET /api/faqs/?lang=bn
# Get FAQ in English (default)
GET /api/faqs/:id
# Get FAQs in Hindi
GET /api/faqs/:id?lang=hi
# Get FAQs in Bengali
GET /api/faqs/:id?lang=bn
POST /api/faqs/
Content-Type: application/json
{
"question": "What is your name?",
"answer": "John"
}
DELETE /api/faqs/:id
To run unit tests for the application, use:
npm test
To run ESlint, use:
npm run lint
To contribute please follow these steps:
-
Fork the repository and clone it locally.
-
Create a new branch for your feature:
git checkout -b new-feature
-
Commit your changes with meaningful messages:
git commit -m "feat: Add support for German translations"
-
Run tests before pushing:
npm test
-
Push your branch and create a Pull Request:
git push origin new-feature