Skip to content

fyzanshaik/Code-Copy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Project README 🚀

Overview 🌟

This project consists of two main components:

  1. Backend: A Go-based server that provides API endpoints for accessing program files, metadata, and cache management. 🏗️
  2. Frontend: A React and TypeScript application that displays a hierarchical sidebar for navigating classes, semesters, years, courses, and program files. The frontend also features a code editor for viewing and editing file contents with syntax highlighting. 🖥️✍️

Backend 🏗️

Description

The backend is implemented using Go with the Gin web framework and Redis for caching. It provides various API endpoints for retrieving and managing code files, metadata, and cache status.

API Endpoints 📡

  • GET /program/:year/:semester/:class/:course/:filename: Retrieve a code file.
  • GET /download/:year/:semester/:class/:course/:filename: Download a code file.
  • GET /structure: Retrieve directory structure.
  • GET /years: Retrieve list of years.
  • GET /years/semesters: Retrieve list of semesters.
  • GET /:year/:semester/:class/:course/:filename: Handle metadata.
  • GET /course/:year/:semester/:class: Retrieve courses.
  • GET /programs/:year/:semester/:class/:course: Retrieve programs.
  • GET /metadata/:year/:semester/:class/:course/:filename: Retrieve metadata.
  • GET /cache-status: Retrieve cache status.
  • POST /clear-cache: Clear the cache.
  • GET /health: Health check.
  • GET /metrics: Retrieve metrics.
  • GET /version: Retrieve version information.

Installation and Setup 🛠️

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-directory>
  2. Install Go and Redis:

  3. Install Go dependencies:

    cd backend
    go mod tidy
  4. Run the server:

    go run .
  5. Ensure Redis is running:

    redis-server

Build Commands ⚙️

To build the backend for different operating systems:

  • Windows:

    GOOS=windows GOARCH=amd64 go build -o backend.exe
  • Linux:

    GOOS=linux GOARCH=amd64 go build -o backend
  • MacOS:

    GOOS=darwin GOARCH=amd64 go build -o backend

Frontend 🖥️

Description

The frontend is implemented using React with TypeScript, Vite, and Tailwind CSS. It includes a sidebar for navigating the hierarchical structure and a code editor for viewing and editing code files.

Setup 🛠️

  1. Navigate to the frontend directory:

    cd frontend
  2. Install Node.js dependencies:

    npm install
  3. Start the development server:

    npm run dev

Project Structure 📁

  • src/components/Sidebar.tsx: Contains the sidebar component for displaying the hierarchy.
  • src/components/CodeEditor.tsx: Contains the code editor component with syntax highlighting.
  • src/api/requests.ts: Contains functions for making API requests to the backend.

Development 🔨