Code Monkey home page Code Monkey logo

achievement-tracker-api's Introduction

Achievement Tracker API

Achievement Tracker API is a Laravel-based application that manages user achievements, comments, and lesson tracking. This RESTful API provides endpoints for user authentication, achievement retrieval, comment creation, and lesson tracking functionalities.

Table of Contents

Installation

To set up and run this application locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/amremaish/achievement-tracker-api.git
  2. Navigate to the project directory:

    cd achievement-tracker-api
  3. Install dependencies using Composer:

    composer install
  4. Set up the environment variables by creating a .env file. Use the .env.example file as a reference:

    cp .env.example .env

    Update the necessary configurations like the database connection details.

  5. Generate an application key:

    php artisan key:generate
  6. Run the database migrations:

    php artisan migrate
  7. Serve the application:

    php artisan serve

Usage

The Achievement Tracker API offers various endpoints to interact with the system. You can use tools like Postman or any HTTP client to access these endpoints.

Ensure you have appropriate authentication credentials (JWT token) for accessing protected endpoints.

Diagram

Database Diagram

This diagram represents the structure of the database used in the Achievement Tracker API.

Endpoints

Authentication

  • POST /api/auth/login: Log in and obtain a JWT token.

    curl --location 'http://127.0.0.1:8000/api/auth/login' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "email": "[email protected]",
        "password": "123456"
    }'
  • POST /api/auth/signup: Register a new user.

    curl --location 'http://127.0.0.1:8000/api/auth/signup' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "name" :"user",
        "email": "[email protected]",
        "password": "123456"
    }'
  • POST /api/auth/logout: Log out and invalidate the token.

  • POST /api/auth/refresh: Refresh the token.

Achievements and User

  • GET /api/user: Get user details.

    curl --location 'http://127.0.0.1:8000/api/user' \
    --header 'Authorization: Bearer YourToken'
  • GET /api/users/{user}/achievements: Retrieve user achievements.

    curl --location 'http://127.0.0.1:8000/api/users/1/achievements' \
    --header 'Authorization: Bearer YourToken'
  • POST /api/comments/create: Create a new comment.

    curl --location --request POST 'http://127.0.0.1:8000/api/comments/create' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer YourToken' \
    --header 'Accept: application/json'
  • POST /api/lessons/{lessonId}/watch: Mark a lesson as watched.

    curl --location --request POST 'http://127.0.0.1:8000/api/lessons/11/watch' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer YourToken'

For detailed information on request and response formats, refer to the API documentation or explore the codebase.

Controllers

  • AuthController: Manages user authentication (login, signup, logout, token refresh).
  • AchievementsController: Retrieves and manages user achievements.
  • CommentController: Handles comment creation.
  • LessonController: Manages lesson tracking functionalities.

Each controller provides specific functionalities related to the corresponding domain.

Routes

The api.php file contains the API routes registered by the application. These routes map HTTP methods to the appropriate controller methods and define the API structure.

Contributing

Contributions to this project are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request. Please follow the contribution guidelines provided in the repository.

achievement-tracker-api's People

Contributors

amremaish avatar

Watchers

Tom avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.