49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
// 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(
|
|
{
|
|
AvailableContainers: [
|
|
{
|
|
Type: 'Chassis',
|
|
BorderColor: '#ff0000',
|
|
TypeChildContainerDefault: 'Trou',
|
|
BorderWidth: 48,
|
|
MinWidth: 500,
|
|
MaxWidth: 3000
|
|
}
|
|
],
|
|
AvailableSymbolModels: [],
|
|
MainContainer: {
|
|
Type: 'Trou',
|
|
BorderColor: '#ffffff',
|
|
Height: 1600,
|
|
Width: 20000
|
|
}
|
|
}
|
|
);
|
|
return new Response(json, {
|
|
status: 200,
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Headers': '*'
|
|
}
|
|
});
|
|
}
|
|
|
|
return new Response('Welcome to Bun!', {
|
|
status: 200,
|
|
headers: {
|
|
'Content-Type': 'text/plain',
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Headers': '*'
|
|
}
|
|
});
|
|
}
|
|
});
|