Implement SmartMenuiserie API + added bun test-server

This commit is contained in:
Hydroxycarbamide 2022-07-30 19:56:41 +02:00
parent 281cd92194
commit b4806db91a
21 changed files with 377 additions and 244 deletions

49
test-server/http.js Normal file
View file

@ -0,0 +1,49 @@
// 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': '*'
}
});
}
});