Merged PR 185: Implement Messages

This commit is contained in:
Eric Nguyen 2022-09-16 10:03:41 +00:00
parent 8a7196eeac
commit e94671d1d8
15 changed files with 242 additions and 15 deletions

View file

@ -10,7 +10,7 @@ serve({
let json;
if (url.pathname === '/GetSVGLayoutConfiguration') {
json = GetSVGLayoutConfiguration();
} else if (url.pathname === '/ApplicationState') {
} else if (url.pathname === '/SetContainerList') {
const bodyParsed = await request.json();
console.log(bodyParsed);
switch (bodyParsed.Action) {
@ -23,6 +23,17 @@ serve({
default:
break;
}
} else if (url.pathname === '/GetFeedback') {
const bodyParsed = await request.json();
console.log(bodyParsed);
json = {
messages: [
{
text: `${new Date()}`,
type: 3
}
]
}
} else {
// TODO: Return 404 rather than this
json = GetSVGLayoutConfiguration();

View file

@ -10,7 +10,7 @@ const requestListener = async(request, response) => {
response.setHeader('Content-Type', 'application/json');
const url = request.url;
let json;
if (url === '/ApplicationState') {
if (url === '/SetContainerList') {
const buffers = [];
for await (const chunk of request) {
buffers.push(chunk);