Merge branch 'front' into docker-front

This commit is contained in:
Adam
2025-10-16 13:32:12 +02:00
committed by GitHub
30 changed files with 2270 additions and 25 deletions

View File

@ -1,5 +1,6 @@
import fastifyJWT from '@fastify/jwt';
import fastifyCookie from '@fastify/cookie';
import cors from '@fastify/cors'
import { register } from './register.js';
import { login } from './login.js';
@ -23,6 +24,12 @@ authDB.prepareDB();
*/
export default async function(fastify, options) {
fastify.register(cors, {
origin: process.ENV.CORS_ORIGIN || 'http://localhost:5173',
credentials: true,
methods: [ "GET", "POST", "DELETE", "OPTIONS" ]
});
fastify.register(fastifyJWT, {
secret: process.env.JWT_SECRET || '123456789101112131415161718192021',
cookie: {

View File

@ -1,5 +1,6 @@
import fastifyJWT from '@fastify/jwt';
import fastifyCookie from '@fastify/cookie';
import cors from '@fastify/cors'
import Database from 'better-sqlite3';
var env = process.env.NODE_ENV || 'development';
@ -56,6 +57,13 @@ const deleteFriends = database.prepare('DELETE FROM friends WHERE username = ?;'
* @param {import('fastify').FastifyPluginOptions} options
*/
export default async function(fastify, options) {
fastify.register(cors, {
origin: process.ENV.CORS_ORIGIN || 'http://localhost:5173',
credentials: true,
methods: [ "GET", "POST", "DELETE", "OPTIONS" ]
});
fastify.register(fastifyJWT, {
secret: process.env.JWT_SECRET || '123456789101112131415161718192021',
cookie: {