Skip to content

SudoSOS is a Node.js-based Bar and POS system made for study association GEWIS.

License

Notifications You must be signed in to change notification settings

GEWIS/sudosos-backend

Folders and files

NameName
Last commit message
Last commit date
Feb 11, 2025
Jan 15, 2022
Sep 26, 2020
Sep 28, 2024
Feb 8, 2025
Feb 24, 2025
Aug 23, 2024
Feb 11, 2025
Jul 28, 2020
Feb 7, 2025
Jun 2, 2024
Jun 2, 2024
Feb 27, 2020
Sep 28, 2024
Feb 21, 2023
Sep 5, 2024
Aug 23, 2024
Sep 28, 2024
Jul 14, 2020
Sep 16, 2024
Nov 6, 2024
Oct 18, 2024
Dec 15, 2023
Feb 17, 2025
Feb 17, 2025
Dec 15, 2023
Aug 1, 2024
Sep 28, 2024

Repository files navigation

Logo

SudoSOS Backend

Uptime Build Latest Release Issues Commit Activity Code Size License

Quick start

This quick start first states what software needs to be installed to be able to work with the project and then explains how to get the project started.

Prerequisites:

  • Have Node.js installed. Version 18 is required.
    • Note that NPM 14.16 (latest) might not run the coverage on Linux. This is probably a race condition in the package and is being addressed.
  • Have Git and possibly a Git manager installed
  • Have OpenSSL installed (if you're using Git Bash you already have OpenSSL)
  • Have a SQLite viewer installed (optional, you can also set it to be saved in another database, but SQLite is the default). Recommended tools are DB Browser for SQLite or DataGrip.

Installing:

  • Checkout the Git to your favorite directory -- If your path contains spaces you are basically begging for problems, and that is entirely your own fault
  • Copy .env.example to .env
  • Run npm install in this base directory
  • Run openssl genrsa -out config/jwt.key 2048
  • Check that there exists a jwt.key file in the config directory starting with -----BEGIN RSA PRIVATE KEY-----
  • Run npm run swagger
  • Run npm run build
  • Run npm run test - All of these should now pass

Running:

  • OR without seed

    • Run npm run schema
    • Check that local.sqlite exists and open it
    • Create an entry in the user table (INSERT INTO "user"(createdAt, updatedAt, version, firstName, lastName, active, deleted, "type") VALUES(datetime('NOW'), datetime('NOW'), 1, 'firstName', 'lastName', 1, 0, 1))
    • Remember the userId (probably 1)
  • OR with seed

    • Run npm run seed
  • Run npm run watch to start the application in development mode

  • Check that http://localhost:3000/api-docs shows a swagger ui

  • You can get a JWT key by using /authentication/mock using a valid userId. You can then use this token to for example set a password to log in on the frontend

  • IN SWAGGER UI USE Bearer <token> TO GET THINGS TO WORK!!

Intellij hints

Easy ESLint intergration

To make sure ESLint fixes your code on save do the following:

  • Have Webstorm version 2020.1 or higher installed
  • Go to Preferences - Language and Frameworks - Javascript - Code Quality Tools - Eslint
  • check Run ESLint --fix on save
  • Apply changes and press ok

Contributors

This project exists thanks to all the people who contribute code.

Code contributors