Skip to content

Jesseekoh/norebase-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Norebase Challenge

Overview

This is a simple implementation of a Like Button feature

Setup

Prerequisites

  • Python 3.x
  • Sqlite

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-directory>
  2. Create a virtual environment and activate it:

    python -m venv .venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Set up the environment variables

    SECRET_KEY=<your_secret_key>
    SQLALCHEMY_DATABASE_URI=<your_database_uri>
  5. Run the application:

    flask run

Configuration

Key configurations include:

  • SECRET_KEY: this should be provided in the .env file
  • SQLALCHEMY_DATABASE_URI: Database connection URI (default: 'sqlite:///default.db')
  • SESSION_TYPE: Session type (default: filesystem)
  • SESSION_COOKIE_HTTPONLY: HTTPOnly flag for session cookies (default: True)
  • SESSION_COOKIE_SECURE: Secure flag for session cookies (default: False)
  • SESSION_PERMANENT: Permanent session flag (default: False)

Usage

The application provides the following endpoints:

User Registration

  • URL: /auth/register
  • Method: POST
  • Payload:
    {
        "username": "your_username",
        "email": "your_email",
        "password": "your_password"
    }
  • Response:
    {
      "message": "You've logged in successfully"
    }

User Login

  • URL: /auth/login
  • Method: POST
  • Payload:
    {
      "email": "your_email",
      "password": "your_password"
    }
  • Response:
    {
      "message": "You've logged in successfully"
    }

Create Post

  • URL: /post/new
  • Method: POST
  • Payload:
    {
      "title": "Post Title",
      "content": "Post Content"
    }
  • Response:
    {
      "message": "Article created successfully",
      "data" {
        "article_id": "articleID"
      }
    }

Like Post

  • URL: /like
  • Method: POST
  • Payload:
    {
      "articleID": "article_id"
    }
  • Response:
    {
      "message": "Liked post"
    }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published