Skip to content

rhaeguard/micronomicon

Repository files navigation

micronomicon

Codacy Badge

The backend for the micro-learning app micronomicon.

Usage:

There are many available tags. User subscribes to new tags and gets a micron to read/watch on those topics. A Micron is a random resource on the given topics.

Endpoints

method endpoint does
POST /register Register a user
POST /login Log a user in
POST /logout Logs the user out
GET /users/me Get the user
GET /users/me/tags Get the user's tags
POST /users/me/tags Add new tags to the user tags
DELETE /users/me/tags Delete tags from the user tags
GET /users/me/microns Get a micron for the user
GET /tags Get all the available tags

/register

Expand

Method : POST

Body

{
    "email": "jane@doe.com",
    "username": "jane",
    "name": "Jane Doe",
    "password": "abc-12345"
}

Response

{
    "message": "Created the user"
}

/login

Expand

Method : POST

Body

{
    "username" : "jane",
    "password" : "abc-12345"
}

Response

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTY1NzE2MjIsImlhdCI6MTU5NjU2NDQyMiwidXNlcm5hbWUiOiJvd2FyeSJ9.CS7osQC8bQihpG7nQKWqUvGQysiB9Y0lkV7tdXSoS-o"
}

/logout

Expand

Method : POST

Headers

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTY1NzE2MjIsImlhdCI6MTU5NjU2NDQyMiwidXNlcm5hbWUiOiJvd2FyeSJ9.CS7osQC8bQihpG7nQKWqUvGQysiB9Y0lkV7tdXSoS-o

Response

{
    "message": "Successfully logged out"
}

/users/me

Expand

Method : GET

Headers

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTY1NzE2MjIsImlhdCI6MTU5NjU2NDQyMiwidXNlcm5hbWUiOiJvd2FyeSJ9.CS7osQC8bQihpG7nQKWqUvGQysiB9Y0lkV7tdXSoS-o

Response

{
    "username": "jane",
    "name": "Jane Doe",
    "email": "jane@hello.com",
    "tags": {
        "tags": [
            {
                "name": "c"
            },
            {
                "name": "react"
            },
            {
                "name": "python"
            }
        ],
        "size": 3
    }
}

/users/me/tags : GET

Expand

Method : GET

Headers

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTY1NzE2MjIsImlhdCI6MTU5NjU2NDQyMiwidXNlcm5hbWUiOiJvd2FyeSJ9.CS7osQC8bQihpG7nQKWqUvGQysiB9Y0lkV7tdXSoS-o

Response

{
    "tags": [
        {
            "name": "c"
        },
        {
            "name": "react"
        },
        {
            "name": "python"
        }
    ],
    "size": 3
}

/users/me/tags : POST

Expand

Method : POST

Headers

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTY1NzE2MjIsImlhdCI6MTU5NjU2NDQyMiwidXNlcm5hbWUiOiJvd2FyeSJ9.CS7osQC8bQihpG7nQKWqUvGQysiB9Y0lkV7tdXSoS-o

Body

{
    "ids": ["c", "angular", "react"]
}

Response

{
    "message": "Successfully added the tags"
}

/users/me/tags : DELETE

Expand

Method : DELETE

Headers

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTY1NzE2MjIsImlhdCI6MTU5NjU2NDQyMiwidXNlcm5hbWUiOiJvd2FyeSJ9.CS7osQC8bQihpG7nQKWqUvGQysiB9Y0lkV7tdXSoS-o

Body

{
    "ids": ["c", "angular", "react"]
}

Response

{
    "message": "Successfully removed the tags"
}

/tags

Expand

Method : GET

Headers

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTY1NzE2MjIsImlhdCI6MTU5NjU2NDQyMiwidXNlcm5hbWUiOiJvd2FyeSJ9.CS7osQC8bQihpG7nQKWqUvGQysiB9Y0lkV7tdXSoS-o

Response

{
    "tags": [
        {
            "name": "c"
        },
        {
            "name": "react"
        },
        {
            "name": "groovy"
        }
    ]
}

/users/me/microns

Expand

Method : GET

Headers

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTY1NzE2MjIsImlhdCI6MTU5NjU2NDQyMiwidXNlcm5hbWUiOiJvd2FyeSJ9.CS7osQC8bQihpG7nQKWqUvGQysiB9Y0lkV7tdXSoS-o

Response

{
    "URL": "https://learnxinyminutes.com/docs/python/",
    "Title": "Python"
}

Running tests

To run all the test, issue the following command:

docker-compose -f docker-compose-test.yml up

About

a simple micro-learning app back-end

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages