No description
Find a file
2025-08-21 16:01:15 +03:00
routes feat(init): german random word api 2025-08-21 16:01:15 +03:00
scripts feat(init): german random word api 2025-08-21 16:01:15 +03:00
services feat(init): german random word api 2025-08-21 16:01:15 +03:00
utils feat(init): german random word api 2025-08-21 16:01:15 +03:00
.gitignore feat(init): german random word api 2025-08-21 16:01:15 +03:00
package-lock.json feat(init): german random word api 2025-08-21 16:01:15 +03:00
package.json feat(init): german random word api 2025-08-21 16:01:15 +03:00
README.md feat(init): german random word api 2025-08-21 16:01:15 +03:00
server.js feat(init): german random word api 2025-08-21 16:01:15 +03:00

🇩🇪 German Words API

A REST API that serves random German words with difficulty filtering based on frequency data from external sources.


Features

  • 🎲 Random German word generation
  • 🎯 Difficulty filtering (beginner, intermediate, advanced)
  • 🔍 Word search functionality
  • 📊 Word statistics and metadata
  • 🌐 External data source integration
  • Rate limiting and security headers
  • 🔄 Data refresh capabilities

Quick Start

1. Install dependencies

npm install

2. Fetch German word data (required for first run)

npm run fetch-data

This will take a few minutes as it fetches data from external APIs.

3. Start the server

npm start

Or for development (with auto-reload):

npm run dev

4. Visit the API


📡 API Endpoints

GET /api/words/random

Get random German words with optional filtering.

Parameters:

  • count (150) → number of words to return (default: 1)
  • difficultybeginner, intermediate, or advanced
  • typenoun, verb, adjective, etc.

Example:

GET /api/words/random?count=5&difficulty=beginner

Search German words by German or English text.

Parameters:

  • q (required) → search query (minimum 2 characters)
  • limit → maximum results (default: 10)

Example:

GET /api/words/search?q=haus&limit=5

GET /api/words/difficulties

Get available difficulty levels.


GET /api/words/types

Get available word types.


GET /api/words/stats

Get word database statistics.


POST /api/words/refresh

Refresh word data from external sources.


📚 Data Sources


🗂️ Project Structure

German-api/
├── package.json           # Dependencies and scripts
├── server.js              # Main Express server
├── services/
│   └── dataFetcher.js     # External API integration
├── scripts/
│   └── fetchData.js       # Data fetching script
├── utils/
│   └── wordProcessor.js   # Word processing logic
├── routes/
│   └── words.js           # API endpoints
├── data/
│   └── german-words.json  # Generated word database
└── README.md

⚙️ Setup Instructions

  1. Run npm install to install dependencies
  2. Run npm run fetch-data to populate the word database
  3. Run npm start to start the API server

The API will be available at: 👉 http://localhost:3000


📄 License

MIT