Skip to content

sayeedmunees/mdme-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MDME Backend

MDME (Mark Down Made Easy) Backend - A simple JSON-based REST API server that provides data persistence for the MDME markdown editor application.

🚀 About

This backend serves as the data layer for MDME, a clean and intuitive markdown editor with real-time preview functionality. Built with Node.js and json-server, it provides RESTful API endpoints for storing, retrieving, and managing markdown documents.

✨ Features

  • RESTful API - Full CRUD operations for markdown documents
  • JSON Database - Lightweight file-based storage using db.json
  • CORS Support - Cross-origin resource sharing enabled
  • Auto-generated Endpoints - Powered by json-server
  • Document Management - Store markdown content with metadata (title, date, ID)

🛠️ Tech Stack

  • Node.js - Runtime environment
  • json-server - RESTful API generator
  • CORS - Cross-origin request handling

📦 Installation

  1. Clone the repository:

    git clone https://github.com/sayeedmunees/mdme-backend.git
    cd mdme-backend
  2. Install dependencies:

    npm install
  3. Start the server:

    npx json-server db.json

The server will start on port 3000 (or the PORT environment variable if set).

🔗 API Endpoints

Base URL: http://localhost:3000

Markdown Documents

Method Endpoint Description
GET /markdown Get all markdown documents
GET /markdown/{id} Get a specific document by ID
POST /markdown Create a new markdown document
PUT /markdown/{id} Update an existing document
DELETE /markdown/{id} Delete a document

Document Structure

{
  "id": "unique-id",
  "title": "Document Title",
  "date": "YYYY-MM-DD",
  "mdData": "# Markdown content here"
}

📁 Project Structure

mdme-backend/
├── node_modules/       # Dependencies
├── db.json             # JSON database file
├── index.js            # Main server file
├── package.json        # Project configuration
└── package-lock.json   # Dependency lock file

🚦 Usage Examples

Get all documents

GET http://localhost:3000/markdown

Create a new document

POST http://localhost:3000/markdown
Content-Type: application/json

{
  "title": "My New Document",
  "date": "2025-10-08",
  "mdData": "# Hello World\nThis is my markdown content."
}

Update a document

PUT http://localhost:3000/markdown/5487
Content-Type: application/json

{
  "title": "Updated Document",
  "date": "2025-10-08",
  "mdData": "# Updated Content\nThis document has been updated."
}

🌐 Environment Variables

Variable Default Description
PORT 3000 Server port number

🔧 Development

To run in development mode:

npx json-server db.json

The server includes CORS middleware to allow cross-origin requests from your frontend application.

📝 Database

The application uses a simple JSON file (db.json) as its database. This file contains all markdown documents and is automatically updated when documents are created, modified, or deleted through the API.

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License.

👨‍💻 Author

Sayeed Munees


Note: This backend is designed to work with the MDME frontend application. Make sure to configure your frontend to point to the correct backend URL.

About

This is the backend for the MDME. MDME (Mark Down Made Easy) provides a clean, intuitive interface for writing and editing markdown with real-time preview functionality.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors