Moving files and rename some of them.

This commit is contained in:
charles-gauthereau
2024-12-16 16:30:00 +01:00
parent c97d68d697
commit 31ee81c10f
75 changed files with 64 additions and 175 deletions
-97
View File
@@ -1,100 +1,3 @@
// import { EventEmitter } from 'events';
//
// const eventEmitter = new EventEmitter();
//
//
// export async function GET(request: Request) {
// return new Response(new ReadableStream({
// async pull(controller) {
// eventEmitter.on('modification', (data) => {
// controller.enqueue(`event: modification\n`);
// controller.enqueue(`data: ${JSON.stringify(data)}\n\n`);
// controller.close();
// });
// },
// }), {
// status: 200,
// headers: {
// 'Content-Type': 'text/event-stream',
// 'Cache-Control': 'no-cache',
// Connection: 'keep-alive',
// },
// });
// }
//
// export async function POST(request: Request) {
// const data = await request.json();
// eventEmitter.emit('modification', data);
// return new Response('Event sent', { status: 200 });
// }
//
// const eventEmitter = new EventEmitter();
//
// export async function GET(request: Request) {
// return new Response(new ReadableStream({
// async pull(controller) {
// eventEmitter.on('modification', (data) => {
// console.log('Modification event triggered:', data);
// controller.enqueue(`event: modification\n`);
// controller.enqueue(`data: ${JSON.stringify(data)}\n\n`);
// });
//
// // Close the controller when the client closes the connection
// request.signal.addEventListener('abort', () => {
// controller.close();
// });
// },
// }), {
// status: 200,
// headers: {
// 'Content-Type': 'text/event-stream',
// 'Cache-Control': 'no-cache',
// Connection: 'keep-alive',
// },
// });
// }
//
// export async function POST(request: Request) {
// const data = await request.json();
// console.log(data);
// eventEmitter.emit('modification', data);
// return new Response('Event sent', { status: 200 });
// }
// const eventEmitter = new EventEmitter();
//
// export async function GET(request: Request) {
// console.log('GET request received');
// return new Response(new ReadableStream({
// async pull(controller) {
// console.log('Controller created:', controller);
// eventEmitter.on('modification', (data) => {
// console.log('Modification event triggered:', data);
// controller.enqueue(`event: modification\n`);
// controller.enqueue(`data: ${JSON.stringify(data)}\n\n`);
// });
// // Close the controller when the client closes the connection
// request.signal.addEventListener('abort', () => {
// controller.close();
// });
// },
// }), {
// status: 200,
// headers: {
// 'Content-Type': 'text/event-stream',
// 'Cache-Control': 'no-cache',
// Connection: 'keep-alive',
// },
// });
// }
//
// export async function POST(request: Request) {
// console.log('POST request received');
// const data = await request.json();
// console.log('Data received:', data);
// eventEmitter.emit('modification', data);
// return new Response('Event sent', { status: 200 });
// }
import { EventEmitter } from 'events';
export const eventEmitter = new EventEmitter();