Skip to content

yemredogru/toni-case

Repository files navigation

Toni-Case #TR

Bu API Kullanıcı Auth işlemlerini, kullanıcıların birbirlerine arkadaşlık isteği gönderme işlemlerini, AWS S3 ve AWS SNS servislerinin kullanımını, Middleware kullanımını ve Mocha ile Unit Test yazımını içerir.

Yükleme

Öncelikle Bilgisayarınıza MongoDB kurmalısınız.

  https://www.mongodb.com/try/download/compass
  https://www.mongodb.com/try/download/community
  Bilgisayarınıza uygun olan işletim sistemini seçerek indirme ve kurulum işlemlerini tamamlayınız.

Kuruluma Node.js kurarak devam ediyoruz.

  https://nodejs.org/en/download
  Bilgisayarınıza uygun olan işletim sistemini seçerek indirme ve kurulum işlemlerini tamamlayınız.

Projeyi başlatmak için gerekli komut

 npm install
 npm start

Mocha ile Testi başlatmak için gerekli komut

 npm test

API Kullanımı

Kayıt Ol

  POST /user/register
Parametre Tip Açıklama
firstName string Gerekli
lastName string Gerekli
phone_number string Gerekli
email string Gerekli
password string Gerekli

Giriş Yap

  POST /user/login
Parametre Tip Açıklama
email string Gerekli
password string Gerekli

Tüm Kullanıcıların Bilgilerini Getir

  GET /user/users

ID'ye Göre Kullanıcı Bilgilerini Getir

  GET /user/user/{id}

Arkadaş Ekle

  POST /user/add-friend/{id}
Parametre Tip Açıklama
Authorization : Bearer {token} string Gerekli

{id} parametresi isteği gönderilen kullanıcın idsine eşittir.

Arkadaşlık İsteğini Kabul Et

  POST /user/accept/{id}

{id} parametresi isteği gönderilen kullanıcın idsine eşittir.

Parametre Tip Açıklama
Authorization : Bearer {token} string Gerekli

Arkadaşlık İsteğini Reddet

  POST /user/reject/{id}

{id} parametresi isteği gönderilen kullanıcın idsine eşittir.

Parametre Tip Açıklama
Authorization : Bearer {token} string Gerekli

Yeni Gönderi Oluştur

  POST /post/newpost
Parametre Tip Açıklama
Authorization : Bearer {token} string Gerekli
description string Gerekli
image string Optional Bu parametre form-data içerisinde "image" parametresi ile ve file olarak gönderilmelidir.

Tüm Gönderileri Gör

  GET /post/posts

ID'ye göre Gönderi Sorgula

  GET /post/posts/{id}

Kullanıcı ID'sine göre Gönderi Sorgula

  GET /post/posts/user/{id}

Ekran Görüntüleri

Örnek Login Request - Postman

Uygulama Ekran Görüntüsü

Örnek Login Request ve Token Alma - Postman

Uygulama Ekran Görüntüsü

Örnek Register Request - Postman

Uygulama Ekran Görüntüsü

Örnek Arkadaşlık Reddetme - Postman

Uygulama Ekran Görüntüsü

Örnek Kullanıcı ID'ye Göre Post Getirme - Postman

Uygulama Ekran Görüntüsü

Kullanılan Teknolojiler

Node, Express, AWS S3, AWS SNS, MongoDB, Mocha

Toni-Case #EN

This API includes User Auth operations, user friend requests to each other, use of AWS S3 and AWS SNS services, use of Middleware, and Unit Test writing with Mocha.

Installation

You must install MongoDB on the user's computer.

  https://www.mongodb.com/try/download/compass
  https://www.mongodb.com/try/download/community
  Complete the download and installation processes by selecting the operating system suitable for your computer.

We continue the installation by installing Node.js.

  https://nodejs.org/en/download
  Complete the download and installation processes by selecting the operating system suitable for your computer.

Required command to start the project

 npm install
 npm start

Required to start Test with Mochakomut

 npm test

API Usage

Register

  POST /user/register
Parameter Type Description
firstName string required
lastName string required
phone_number string required
email string required
password string required

Login

  POST /user/login
Parameter Type Description
email string required
password string required

Fetch All Users' Information

  GET /user/users

Fetch User Information by ID

  GET /user/user/{id}

Add Friend

  POST /user/add-friend/{id}
Parameter Type Description
Authorization : Bearer {token} string required

{id} parameter is equal to the id of the requesting user.

Accept Friend Request

  POST /user/accept/{id}

{id} parameter is equal to the id of the requesting user.

Parameter Type Description
Authorization : Bearer {token} string required

Decline Friend Request

  POST /user/reject/{id}

{id} parameter is equal to the id of the requesting user.

Parameter Type Description
Authorization : Bearer {token} string required

Create New Post

  POST /post/newpost
Parameter Type Description
Authorization : Bearer {token} string required
description string required
image string Optional This parameter should be sent in form-data with the "image" parameter and as a file.

See All Posts

  GET /post/posts

Get Posts By Id

  GET /post/posts/{id}

Get Post By Post ID

  GET /post/posts/user/{id}

Screenshots

Example Login Request - Postman

Uygulama Ekran Görüntüsü

Example Login and Get Access Token Request - Postman

Uygulama Ekran Görüntüsü

Example Register Request - Postman

Uygulama Ekran Görüntüsü

Example Reject Friend Request - Postman

Uygulama Ekran Görüntüsü

Example GET Post By User Id - Postman

Uygulama Ekran Görüntüsü

Used Technologies

Node, Express, AWS S3, AWS SNS, MongoDB, Mocha

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published