Code Monkey home page Code Monkey logo

dikurium's Introduction

DIKIRUIM TEST SOLUTION

This is the solution to a test in respect to an application for a golang position

Task

Implement an authenticated GraphQL API that allows users to track todos. The schema should include the mutations and queries as shown in the attached picture.

Authenticated access should be handled with the Authorization header and Bearer tokens. You can use the golang-jwt/jwt (https://pkg.go.dev/github.com/golang-jwt/jwt) package to generate tokens. If the user isn’t authenticated, the API should return a 401 using middleware/directives.

Your GraphQL schema should implement nested types and field resolvers or preloads to fetch them from the DB. This should work recursively Text Image

Table of Contents

Description

This project is a high-performance, scalable and secure web application developed using the latest technologies and industry best practices. The application is built with a package oriented design, utilizing GORM as the database layer, JWT for secure authentication, and Data Loader to handle N+1 queries for optimal performance.

The application is fully dockerized and ready for deployment in production environments. It has been thoroughly tested to ensure it can handle high traffic loads and maintain optimal performance under stress.

With the use of Viper config, the application is highly configurable, making it easy to deploy in a variety of environments with different configurations.

In addition, Zap has been used as the logging library, ensuring that detailed logs are available for debugging and monitoring.

Overall, this project is a robust, reliable and efficient web application that is well suited for production use. Its use of cutting-edge technologies and best practices ensures that it will continue to perform optimally and maintain high levels of security and reliability.

Installation

To install and run the application, you need to have Docker installed on your machine. If you don't have it installed, please follow the instructions on how to install Docker here.

After Clone the repository and navigate to the project directory and run docker compose up -d

Usage

Sign Up

To sign up a new user, make a POST request to http://localhost:7500/query with the following query:

  signUp(username: "john_doe", email: "[email protected]", password: "password123") {
    success
    message
    user {
      userid
      username
      email
    }
    authToken
  }
}

A sample response would look like

{
    "data": {
        "signUp": {
            "success": true,
            "message": "Successfully created user ",
            "user": {
                "username": "john_doe",
                "email": "[email protected]",
                "userid": "b63fe0dc-d990-4b24-8421-f0bc4ddac77e"
            },
            "authToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiIiwidXNlcm5hbWUiOiJhbGkiLCJlbWFpbCI6ImFiY0BleGFsZWUxMzQuY29tIiwiaXNzIjoiZG9tYWluX3VybCIsInN1YiI6Ik9yZW9sdXdhIiwiZXhwIjoxNjgzMjcxNjY5LCJpYXQiOjE2ODMyNzA0Njl9.K1waM_aC38OTZFQajtVAmdIIYlDrZ3baqK8rOv_gqrs"
        }
    }
}

Learn more about GraphQL mutations and queries

Contact

If you have any suggestions or requests, please feel free to reach out to me. I'll do my best to respond promptly and accommodate your needs as best I can. Thank you for your interest in this project!

dikurium's People

Watchers

Oreoluwa 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.