Skip to content

Truly-Depressed-Developers/study-notes-server

Repository files navigation

Study Notes - server

This repository only contains the server's code. For the main repository, see Truly-Depressed-Developers/study-notes

Features

  • Data storage in database
  • Basic login and register
  • Data access and modification through appropriate endpoints

Tech Stack

Installation

Prerequisities

  • XAMPP
  • Node.js

Database

  1. Launch Apache and MySQL in XAMPP Control Panel
  2. Open localhost/phpmyadmin and import database from SQL file
  3. (optional) Create new user and grant him access to sheepyourhack4 database

Server

Clone this repo on your local machine

git clone https://github.com/MBrosik/sheepyourhack4-server.git
cd sheepyourhack4-server

Install node modules

npm install

Update IP and login credentials in Database.ts. If you skip 3rd step in Database, default should be:

  • host: "localhost"
  • user: "root"
  • password: ""
  • database: "sheepyourhack4"

Run build once to create build folder

npm run build

Start server

npm run start

Database structure

Endpoints

Endpoint (POST) Required data Returned data
/login
  • username: string
  • password: string
  • description: string
  • id: number
/register
  • username: string
  • password: string
  • description: string
/get_one_question
  • id: number
  • question
  • id: number
  • username: string
  • university: string
  • degree_course: string
  • subject: string
  • title: string
  • content: string
  • points: number
  • excercise_set: string
  • timestamp: string
  • answers: list of:
    • username: string
    • content: string
    • timestamp: string
    • upvotes: number
    • best_answer: bool
/add_question
  • id_author: number
  • id_degree_course: number
  • id_subject: number
  • title: string
  • points: number
  • excercise_set: string
  • content: string
  • status: bool
/add_answer
  • id_question: number
  • id_author: number
  • content: string
  • status: bool
/get_universities list of:
  • id: number
  • name: string
/get_courses
  • id_university: number
list of:
  • id: number
  • name: string
/get_subjects list of:
  • id: number
  • name: string
/get_notes
  • id_university: number | undefined
  • id_subject: number | undefined
  • id_degree_course: number | undefined
list of:
  • id: number
  • username: string
  • university: string
  • degree_course: string
  • subject: string
  • title: string
  • timestamp: string
  • upvotes: number
  • approved: bool
/get_one_note
  • id: number
  • id: number
  • username: string
  • university: string
  • degree_course: string
  • subject: string
  • title: string
  • url: string
  • timestamp: string
  • upvotes: number
  • approved: bool
/add_note
  • id_author: number
  • id_degree_course: number
  • id_subject: number
  • title: string
  • url: string
  • status: bool

License

This project is licensed under MIT license.

About

Server for a web app created at SheepYourHack Hackathon (4th Edition; 2022)

Topics

Resources

License

Stars

Watchers

Forks

Contributors