Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanuarprayoga9/sieghart-blog-api
https://github.com/yanuarprayoga9/sieghart-blog-api
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yanuarprayoga9/sieghart-blog-api
- Owner: Yanuarprayoga9
- Created: 2024-03-31T07:08:35.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-13T08:10:39.000Z (9 months ago)
- Last Synced: 2024-04-13T21:58:20.390Z (9 months ago)
- Language: JavaScript
- Homepage: https://sieghart-blog-api.vercel.app
- Size: 121 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PREREQUISITE
node js 21.x.
npm 10.xx# INSTAL
clone project
```json
"git clone =https://github.com/Yanuarprayoga9/sieghart-blog-api.git"
```
setup .env
```json
"PORT=5555"
"MONGO_DB_URL="
"JWT_SECRET="
```# DATABASE DOCUMENTATION
see documentation [here](database.md)
erd = https://drive.google.com/file/d/1ut7GntsVowLVtHwsDnuhmxDXfZ2hbI8R/view?usp=sharing# API SPEC
### BASE URL = https://sieghart-blog-api.vercel.app/v1## AUTHENTICATION
### Signup
Endpoint : POST /auth/signup
Request Body :
```json
{
"username": "yanuar ganteng",
"email": "[email protected]",
"password": "yanuar123"
}
```Response Body Success :
```json
{"user": {
"_id": "660f708fa058ee8749c0a65f",
"username": "yanuar ganteng",
"email": "[email protected]",
"profilePicture": "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png",
"isAdmin": false,
"createdAt": "2024-04-05T03:31:27.266Z",
"updatedAt": "2024-04-05T03:31:27.266Z",
"__v": 0
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2MGY3MDhmYTA1OGVlODc0OWMwYTY1ZiIsImlzQWRtaW4iOmZhbHNlLCJpYXQiOjE3MTIyODkxMDF9.qTZTyeAK6DEjCmekBEU2_n7Kg5JmW_pGS1l3e-gR0Zg"
}
```Response Body Error :
```json
{
"Error: User Already registered
at errorHandler"
}
```### SignIn
Endpoint : POST /auth/signin
Request Body :
```json
{
"email": "[email protected]",
"password": "yanuar123"
}
```Response Body Success :
```json
{"user": {
"_id": "660f708fa058ee8749c0a65f",
"username": "yanuar ganteng",
"email": "[email protected]",
"profilePicture": "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png",
"isAdmin": false,
"createdAt": "2024-04-05T03:31:27.266Z",
"updatedAt": "2024-04-05T03:31:27.266Z",
"__v": 0
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2MGY3MDhmYTA1OGVlODc0OWMwYTY1ZiIsImlzQWRtaW4iOmZhbHNlLCJpYXQiOjE3MTIyODkxMDF9.qTZTyeAK6DEjCmekBEU2_n7Kg5JmW_pGS1l3e-gR0Zg"
}
```Response Body Error :
```json
{
"Error: User Not Found or invalid password"
}
```Endpoint : POST /auth/google
Request Body :
```json
{
"email": "[email protected]",
"password": "yanuar123",
"googlePhotoUrl":""
}
```Response Body Success :
```json
{
{
"user": {
"_id": "660f708fa058ee8749c0a65f",
"username": "yanuar ganteng",
"email": "[email protected]",
"profilePicture": "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png",
"isAdmin": false,
"createdAt": "2024-04-05T03:31:27.266Z",
"updatedAt": "2024-04-05T03:31:27.266Z",
"__v": 0
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2MGY3MDhmYTA1OGVlODc0OWMwYTY1ZiIsImlzQWRtaW4iOmZhbHNlLCJpYXQiOjE3MTIyODkxMDF9.qTZTyeAK6DEjCmekBEU2_n7Kg5JmW_pGS1l3e-gR0Zg"
}}
```Response Body Error :
```json
{
"Error: "
}
```## USER
### Update User
Endpoint : Put /user/googleRequest Body :
```json
{
"username":"yanuar prayoga"
"email": "[email protected]",
"password": "yanuar123",
}
```Response Body Success :
```json
{
{
"update user success"
}}
```Response Body Error :
```json
{
"Error: 401 "
}
```