Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mehradaotp/gallery

Api Karnaval Gallery
https://github.com/mehradaotp/gallery

nestjs nestjs-backend nodejs typescript

Last synced: about 3 hours ago
JSON representation

Api Karnaval Gallery

Awesome Lists containing this project

README

        

## Description

Working With Api Gallery.

## Documention

http://localhost:3000/api

### create file .env

```env
MONGODB =mongodb://localhost:27017/Gallery
PORT = 3000
SECRET_KEY = secret
```

### Project setup

```bash
$ yarn install
```

## Compile and run the project

```bash
# development
$ yarn start

# watch mode
$ yarn start:dev

# production mode
$ yarn start:prod
```

## Users

The administrator is unable to register and enters manually!

Users can register by entering http://localhost:3000/users/register page(METHOD = POST)

```json
{
"username" : "ali",
"password" : "ahmadi@ali"
}
```

For Login http://localhost:3000/auth/login AND METHOD = POST

```json
{
"username" : "ali",
"password" : "ahmadi@ali"
}
```

After Login You Get Api For upload Photo, get all photos user and more

```json
{
"message": "Login successful",
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Im5hc2VyIiwic3ViIjoiNjcxZWZjOTIzNmEzZmQ2ODVmZTY3YWVhIiwicm9sZSI6InVzZXIiLCJpYXQiOjE3MzAyMDI0ODMsImV4cCI6MTczMDIwOTY4M30.RY4lEz_FGiLEBA8CQXG1Gcjd-iFwhmNl4uF8OyBnvX0"
}
```

## Authentication
After logging in, you will get a token. and expire in 2h
Now you have to put that token in the Authorization tab of the Bearer Token type

### Photos
The user can upload the photo by entering the page http://localhost:3000/photos/upload and sending the desired information through from-data.

METHOD = POST

#### you can get ID Categories From http://localhost:3000/category

METHOD = GET

Example :

```json
{
"file":"Type file and upload",
"title" : "sun",
"description" : "i love sun",
"categories" : "671ef49ccc0cc0bb42d3d9be"
}
```


Now , User can see all uploaded photos
http://localhost:3000/photos/my-photos

Method = GET

###### Also, the user can see all the photos on the site (confirmed photos).

METHOD = GET

http://localhost:3000/photos