File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
packages/core/src/application Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ export class Application {
3737 const path = this . normalizePath ( request . path ) ;
3838
3939 switch ( path ) {
40+ case '' :
41+ case '/' :
42+ return this . welcomeResponse ( ) ;
43+
4044 case '/storeavalue' :
4145 return await this . storeHandler . handle ( request ) ;
4246
@@ -56,6 +60,25 @@ export class Application {
5660 return path . toLowerCase ( ) . replace ( / \/ $ / , '' ) ;
5761 }
5862
63+ private welcomeResponse ( ) : HttpResponse {
64+ return {
65+ status : 200 ,
66+ headers : {
67+ 'Content-Type' : 'application/json' ,
68+ } ,
69+ body : JSON . stringify ( {
70+ service : 'TinyWebDB' ,
71+ version : '1.0' ,
72+ endpoints : {
73+ '/storeavalue' : 'POST - Store a tag-value pair' ,
74+ '/getvalue' : 'POST - Get a value by tag' ,
75+ '/deleteentry' : 'POST - Delete an entry by tag' ,
76+ } ,
77+ documentation : 'https://ai2.appinventor.mit.edu/reference/other/tinywebdb.html' ,
78+ } ) ,
79+ } ;
80+ }
81+
5982 private notFoundResponse ( ) : HttpResponse {
6083 return {
6184 status : 404 ,
You can’t perform that action at this time.
0 commit comments