Giter Club home page Giter Club logo

vk-test's Introduction

VK-TEST

API Routes

Authentication

  • POST /signup: Register a new user.
  • POST /signin: Login with existing credentials.
  • POST /refresh-token: Refresh JWT token.

Ads Management

  • POST /create-ad: Create a new ad.
  • GET /all-ads: Get all ads
  • GET /ads-by-page: Get ads on the page (written param in the query)

Examples

- localhost:8080/all-ads?date_order=desc

- localhost:8080/all-ads?max_price=1000&price_order=asc

- localhost:8080/all-ads?max_price=1000&price_order=asc&min_price=300

- localhost:8080/ads-by-page?price_order=desc&page=2

- localhost:8080/ads-by-page?date_order=asc&page=2

Running the Application

To run the application, execute the following command in your terminal:

go run ./cmd

To register use the following json pattern

{
  "email": "[email protected]",
  "password": "useMeForLoginAlso!"
}

In order to add an ad you should be authorized, and if so, use the following json pattern Max image size 1MB

{
  "title": "Продается дача",
  "text": "Дача в 100 км от города. 6 соток, дом 80 м2.",
  "image_url": "https://www.example.com/dacha.jpg",
  "price": 1500000.0
}

Make sure to set the necessary environment variables in a .env file before running the application.

Dependencies

Environment Variables

The application requires the following environment variables to be set:

  • MONGO_URI: MongoDB connection URI.
  • PORT: Port number for the server.
  • JWT_SECRET: Secret key for JWT token generation.
  • GIN_MODE: Gin mode (debug or release).

Ensure these environment variables are correctly set in a .env file before running the application.

vk-test's People

Contributors

ctuzelov avatar

Watchers

 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.