go-markdown-note-taking-app

module
v0.0.0-...-4dea34c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2025 License: MIT

README

Go Markdown Note-Taking App

A simple note-taking API built with Go that allows users to upload markdown files, check grammar, save notes, and render them as HTML.

Based on Markdown Note-Taking App Project from roadmap.sh.

Features

  • ✅ Upload and save markdown notes
  • ✅ Grammar checking for notes
  • ✅ List all saved notes
  • ✅ Render markdown notes as HTML
  • ✅ RESTful API design
  • ✅ Docker support for easy deployment
  • ✅ Comprehensive API documentation (OpenAPI/Swagger)

Project Structure

go-markdown-note-taking-app/
├── cmd/
│   └── server/
│       └── main.go           # Application entry point
├── internal/
│   ├── api/
│   │   ├── handlers/         # HTTP handlers
│   │   ├── middleware/       # Middleware functions (CORS, logging)
│   │   └── routes/           # Route definitions
│   ├── config/               # Configuration management
│   ├── models/               # Data models
│   ├── services/             # Business logic
│   │   ├── grammar/          # Grammar checking service
│   │   ├── markdown/         # Markdown processing service
│   │   └── storage/          # Note storage service
│   └── utils/                # Utility functions
│       ├── errors/           # Error handling utilities
│       ├── file/             # File handling utilities
│       └── testutils/        # Testing utilities
├── api/
│   └── openapi.yaml          # OpenAPI specification
├── docs/                     # Documentation
├── examples/                 # Example markdown files
├── scripts/                  # Build and deployment scripts
├── docker/                   # Docker-related files
├── notes/                    # Directory for stored notes
├── go.mod
├── go.sum
├── Dockerfile
├── docker-compose.yml
└── README.md

Prerequisites

  • Go 1.21 or higher
  • Docker and Docker Compose (optional, for containerized deployment)
  • Git

Installation

  1. Clone the repository:
git clone https://github.com/JumpingMonkey/go-markdown-note-taking-app.git
cd go-markdown-note-taking-app
  1. Install dependencies:
go mod download
  1. Create the notes directory:
mkdir -p notes

Running the Application

Local Development
go run cmd/server/main.go

The server will start on http://localhost:8080 by default.

Using Docker
docker-compose up --build

API Endpoints

1. Save a Note
  • POST /api/v1/notes
  • Request Body:
    {
      "title": "My Note",
      "content": "# Markdown content here"
    }
    
  • Response: Created note with ID
2. Check Grammar
  • POST /api/v1/notes/check-grammar
  • Request Body:
    {
      "content": "Text to check for grammar"
    }
    
  • Response: Grammar check results
3. List All Notes
  • GET /api/v1/notes
  • Response: Array of saved notes
4. Get a Specific Note
  • GET /api/v1/notes/{id}
  • Response: Note details in markdown format
5. Get HTML Rendered Note
  • GET /api/v1/notes/{id}/html
  • Response: Note rendered as HTML
6. Upload Markdown File
  • POST /api/v1/notes/upload
  • Request: Multipart form with markdown file
  • Response: Created note with ID

API Documentation

The API documentation is available in OpenAPI format:

  • View the OpenAPI specification: /api/v1/docs/openapi.yaml
  • Interactive Swagger UI: /api/v1/docs (when running the server)

Configuration

The application can be configured using environment variables:

  • PORT: Server port (default: 8080)
  • NOTES_DIR: Directory to store notes (default: ./notes)
  • LOG_LEVEL: Logging level (default: info)

Development

Running Tests
# Local tests (if Go is installed)
go test ./...

# Docker-based tests (no Go installation required)
./scripts/run-tests.sh
Building the Application
go build -o bin/server cmd/server/main.go
Code Style

This project follows the standard Go formatting guidelines. Use go fmt to format your code:

go fmt ./...

Docker Support

Building the Docker Image
docker build -t go-markdown-note-app .
Running with Docker Compose
docker-compose up -d
Common Docker Issues

If you encounter build errors related to Go modules during the Docker build process, try the following solutions:

  1. Ensure your go.mod and go.sum files are properly initialized
  2. Use the provided Docker configuration which includes all necessary build dependencies
  3. For detailed logs, check the Docker build output with the -v flag enabled

This will start the application along with any required services.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -am '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 - see the LICENSE file for details.

Acknowledgments

Directories

Path Synopsis
cmd
server command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL