Skip to content

phcarneirobc/free-learn-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FreeLearn BackEnd

Backend for FreeLearn website.

Build

$ git clone https://github.com/phcarneirobc/free-learn-backend
$ cd free-learn-backend
$ go run .
$ docker compose up -d

🛣️ API Endpoints

Authentication

Method Endpoint Description Request Body
POST /register Register a new user {"name": "User", "email": "user@example.com", "password": "password123"}
POST /login Authenticate a user {"email": "user@example.com", "password": "password123"}

Products

Method Endpoint Description Authentication
POST /product Create a new product Required
GET /product/:id Get product by ID Not Required
GET /product/images Get product images by ID (query) Not Required
PUT /product/:id Update product details Required
DELETE /product/:id Delete a product Required
GET /search Search products (query param: q) Not Required

Collections

Method Endpoint Description Authentication
POST /collection Create a new collection Required
GET /collection/:id Get collection by ID Not Required
GET /collections Get all collections Not Required
PUT /collection/:id/product Add product to collection Required
DELETE /collection/:id/product/:productId Remove product from collection Required

📦 Product Creation

Products can be created by sending a multipart/form-data request with the following fields:

name: Product Name
description: Product Description
codeName: Internal Code Name
team: true/false
coverImage: [file upload]
heroImage: [file upload]
frontImage: [file upload]
backImage: [file upload]
leftImage: [file upload]
rightImage: [file upload]

📑 Collection Creation

Collections can be created in two ways:

JSON Request

Content-Type: application/json

{
  "name": "Collection Name",
  "description": "Collection Description",
  "products": ["productId1", "productId2"]
}

Form Data Request

Content-Type: multipart/form-data

name: Collection Name
description: Collection Description
products: productId1
products: productId2
imageUrl: [file upload]

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors