No description
  • JavaScript 95.6%
  • Shell 4.1%
  • Dockerfile 0.3%
Find a file
2026-07-30 09:36:16 +02:00
maintenance added admin route for user creation 2026-06-30 22:42:39 +02:00
src added return in error handlers for replies and creating example thumbnails 2026-07-30 09:36:16 +02:00
.dockerignore implemented sequelize and zod 2026-07-10 22:29:16 +02:00
.gitignore added auth and permissions system, image upload 2026-06-25 11:01:14 +02:00
.prettierignore some progress for logging in 2025-07-12 17:23:55 +02:00
.prettierrc restructured project, added nodemon, prettier and some more routing 2025-07-08 21:44:52 +02:00
Dockerfile added return in error handlers for replies and creating example thumbnails 2026-07-30 09:36:16 +02:00
LICENSE Initial commit 2025-07-07 21:46:21 +02:00
nodemon.json new structure 2026-03-11 13:36:48 +01:00
package-lock.json put auth routes in auth subfolder 2026-07-12 18:27:43 +02:00
package.json added return in error handlers for replies and creating example thumbnails 2026-07-30 09:36:16 +02:00
README.md formatted and setup for local development 2026-07-01 12:55:13 +02:00

PizzaPorfavore

The backend for PizzaPorfavore

Configuration

The configuration happens via a .env file. Here is a file with all possible keys and example values. You can generate required secret with openssl rand -hex 64.

PORT=3000
DATABASE_PATH=database.db
SCHEMA_FILE=schema.sql
ADMIN_USERNAME=admin
ADMIN_PASSWORD=password
SALT_ROUNDS=10
INSERT_EXAMPLE_ENTRIES=true
JWT_SECRET=a0ddeb7a9c0608557729ca0737ec0886dea88ec81d363a8570f735be7fd3cfc32739b7607251b0e37e1af6d86c25212f328ce3541f327da5e2db874f7ec51ce0
JWT_REFRESH_SECRET=91675dd632547121780f2f3a75ed2d2c4a2bc569b764227d3c2969481387f10c2c616739fbb03eadaf30daee1fab3aa1633a5c009a568f159ae6e5813fdba724
COOKIE_SECRET=6573027e05a49a15524b3095420def56023afe3abe14f283dbd1e79cd6ad826a93447ed7d92fb78923211f418af83a3f7e47a88f54aa2bf3108676b0c15fffa8

Error Handling

  • Erwartete Fehler (z. B. Auth, Validation, Business-Logik) direkt mit reply.code(...).send(...) beantworten

    return reply.code(401).send({
        code: 'INVALID_REFRESH_TOKEN',
    })
    
  • Unerwartete Fehler (z. B. DB/API/Bugs) mit throw werfen und im globalen setErrorHandler(...) behandeln

    throw fastify.httpErrors.internalServerError(
        'An error occurred while updating the meal'
    )
    
  • Nicht mischen: pro Fehlerfall entweder reply.send(...) oder throw

    // vermeiden
    reply.code(500)
    throw new Error('...')