Skip to content

Jannis-Passalis/easycoding-be

 
 

Repository files navigation

Easycoding-Server

This server is made to be connected with the client of Easycoding and is deployed with Heroku.

Functionalities and Technology

Functionalities

  • Endpoints to get, post and patch data from the Easycoding Database (by using PostgreSQL and ElephantSQL.
  • Makes a user an Admin or Blocks a user (there is an Admin check for those)
  • Authorization checks with middleware.
  • Running server with Express
  • Managing the database models and migrations with Sequelize

Languages and Tools

nodejs-icon vscode-icon javascript-icon sequelize-logo postgresql-icon

Installation Guide

  • Install dependencies
npm install
  • Configure your database in config/config.json

  • Create database, run migrations & seed data

npx sequelize-cli db:migrate
npx sequelize-cli db:seed:all
  • Start your server
npm start

Endpoints

Method Path Purpose Required Parameteres Auth
POST '/answer' Adds an answer in DB content, commentId yes
POST '/answer/:answerId' Edits an answer in DB content yes
DELETE '/answer/:answerId' Delete an answer from DB answerId yes
DELETE '/answer/admin/:answerId' Delete an answer from DB (Only admin can use this) answerId yes
GET 'user/me' Get user that is logged in none yes
POST '/login' Login a user email, password no
POST '/signup' Sign up a new user name, email, password, picture no
POST '/comment' Adds a comment content, postId, requestId yes
PUT '/comment/:commentId' Edits a comment content, commentId yes
DELETE '/comment/:commentId' Deletes a comment commentId yes
DELETE '/comment/admin/:commentId' Delete a comment from DB (Only admin can use this) commentId yes
GET '/favourite' Gets all users with comments and answers from author relation none yes
POST '/favourite' Sets new favourite postId yes
DELETE '/favourite/:postId' Deletes a favourite postId yes
GET '/picture/:postId' Gets a picture postId yes
POST '/picture/' Adds a picture name, picture yes
PUT '/picture/:postId' Updates a picture name, picture, postId yes
DELETE '/picture/:id' Deletes a picture id (of the picture) yes
GET '/posts' Gets all posts none no
POST '/posts' Adds a post title, content yes
PUT '/posts/:postId' Updates a post title, content, postId yes
DELETE '/posts/:postId' Deletes a post postId yes
DELETE '/posts/admin/:postId' Deletes a post (Only admin can use this) postId yes
GET '/request' Gets all requests none no
POST '/request' Adds a request title, content yes
PUT '/request/:requestId' Updates a request title, content, requestId yes
DELETE '/request/:requestId' Deletes a request requestId yes
DELETE '/request/admin/:requestId' Deletes a request (Only admin can use this) requestId yes
POST '/users' Gets all users (Only admin can use this) none yes
PUT '/users/profile' Updates user name or picture or email yes
PUT '/users/block/:id' Blocks/Unblockes a user id (of the user that is going to be blocked/unblocked) yes
PUT '/users/admin/:id' Makes or deletes a user from admin id (of the user that is going to be changed) yes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.9%
  • Shell 0.1%