Implement SmartMenuiserie API + added bun test-server
This commit is contained in:
parent
281cd92194
commit
b4806db91a
21 changed files with 377 additions and 244 deletions
49
test-server/http.js
Normal file
49
test-server/http.js
Normal 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': '*'
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue