Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/mehradaotp/gallery
- Owner: MehradAotp
- Created: 2024-10-27T18:12:43.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-12-05T14:30:32.000Z (about 1 month ago)
- Last Synced: 2024-12-05T15:30:58.255Z (about 1 month ago)
- Topics: nestjs, nestjs-backend, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 1.83 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 = GETExample :
```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