// http.js import { serve } from 'bun'; serve({ port: 5000, fetch(request) { console.log(`${request.method}: ${request.url}`); if (request.method === 'POST') { const json = JSON.stringify(getBody()); return new Response(json, { status: 200, headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' } }); } return new Response('Welcome to Bun!', { status: 200, headers: { 'Content-Type': 'text/plain', 'Access-Control-Allow-Origin': '*' } }); } }); const getBody = () => { return { AvailableContainers: [ { Type: 'Chassis', BorderColor: '#ff0000', TypeChildContainerDefault: 'Trou', BorderWidth: 48, MinWidth: 500, MaxWidth: 3000, Width: 500, Style: { fillOpacity: 0, borderWidth: 2, stroke: 'red' } }, { Type: 'Trou', BorderColor: '#FFFFFF', TypeChildContainerDefault: 'Remplissage' }, { Type: 'Remplissage', BodyColor: '#99C8FF', BorderColor: '#00FF00', ContainerDimensionning: { DimensionningStyle: 1 }, ContainerActions: [ { Action: 'SplitRemplissage', Label: 'Diviser le remplissage', Description: 'Diviser le remplissage en insérant un montant', CustomLogo: { Url: '' } } ] }, { Type: 'Montant', BorderColor: '#FFA947', BodyColor: '#FFA947', Width: 50, XPositionReference: 1 }, { Type: 'Ouverture', BorderColor: '#FF6DE6', BodyColor: '#FFA3D1', ContainerDimensionning: { ShowDimensionning: false } }, { Type: 'Dilatation', BodyColor: '#000000', Width: 8, ContainerDimensionning: { ShowLabel: false } }, { Type: '', BorderColor: '#54616c', BodyColor: '#dee2e4', ContainerActions: [{ ContainerActions: { Action: 'FillHoleWithChassis', Label: 'Calepiner', Description: 'Remplir le trou avec des châssis', CustomLogo: { Url: '' }, AddingBehavior: 0 } }] } ], AvailableSymbols: [ { Name: 'Poteau structure', Image: { Url: 'https://www.manutan.fr/img/S/GRP/ST/AIG3930272.jpg' } }, { Name: 'Joint de structure', Image: { Url: 'https://e7.pngegg.com/pngimages/647/127/png-clipart-svg-working-group-information-world-wide-web-internet-structure.png' } } ], MainContainer: { Type: 'Trou', BorderColor: '#ffffff', Height: 300, Width: 2000 } }; };