项目作者: aadilraza339

项目描述 :
It is like a social media app it has login, sign up, send friend request. Add friend, create post, edit profile, forgot password. (as like Facebook clone) :( without chat option
高级语言: JavaScript
项目地址: git://github.com/aadilraza339/Social-Media-like-Facebook.git
创建时间: 2021-04-30T20:35:38Z
项目社区:https://github.com/aadilraza339/Social-Media-like-Facebook

开源协议:MIT License

下载


Node.Js Social media Back-end

The task for Backend dev:

Social Media Application :
Design and develop REST APIs using node.js for a mini social media app which including the following ( Frontend is not required ):

  1. Refresh token for authentication.
  2. Relational database (Postgres is a plus)
  3. Cache
  4. Logging
  5. Documentation

Design DB and API endpoints based on the following features :

  1. Authentication - Login / Register / Forgot Password / Profile Update with profile pic
  2. Friends - Send a friend request / Accept & Reject friend request / Remove Friend / View My Friends / View Friends of Friends / View Mutual Friends
  3. Posts - Add post / Delete post
  4. Chat ( Optional and is a plus )

HOW TO RUN 🏃‍ PROJECT

git clone https://github.com/aadilraza339/Social-Media-like-Facebook.git

cd Social-Media-like-Facebook

npm intall

For caching I used redis, if you want to know about click here

mkdir redis && cd redis

curl -O http://download.redis.io/redis-stable.tar.gz tar xzvf redis-stable.tar.gz

cd redis-stable

make

make test

redis-server

config your .env

import code.sql in your MySql DB
Now is time to run it 🥳 In the root directory👇

nodemon app.js

I used these things to make this project.

Express JWT bcrypt knex mysql nodemailer redis


These are the endpoints Below you Can run them using postman, here is the link for downloadclick here

  1. router.post('/signup', userControllers.userRegister);
  2. router.post('/login', userControllers.userLogin);
  3. router.get('/home', checkAuth, userControllers.get_post);
  4. router.get('/user/:username', checkAuth, userControllers.getMe);
  5. router.post('/forgotpassword', userControllers.forgotP);
  6. router.post('/reset',userControllers.resetP)
  7. router.post('/newpost', checkAuth, userControllers.newpost);
  8. router.delete('/deletePost/:post_id', checkAuth, userControllers.deletePost)
  9. router.put('/editprofile', checkAuth, userControllers.updateProfile)
  10. router.post('/sendReq/:fId', checkAuth, friendControllers.sendReq);
  11. router.get('/friendlist', checkAuth, friendControllers.friendlist);


this endpoint Below, you want to run, so then you have to tell Action and friend_id , what could be Action



addfriend/{fId}

reject/{fId}

block/{fId}

  1. router.post('/:Action/:fId', checkAuth, friendControllers.Frirequest);