File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed
Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,8 @@ export function minBrowserVersion(context: Context) {
99
1010 const { features, filter } = context . req . queries ( ) ;
1111 if ( ! features || features . length === 0 ) {
12- return context . body (
13- "Feature parameter is required. Please provide at least one feature to check. Example: ?features=AbortController" ,
14- 400 ,
15- { "Content-Type" : "text/plain" } ,
12+ throw new Error (
13+ "No features provided. Please provide at least one feature to check the minimum browser version." ,
1614 ) ;
1715 }
1816
Original file line number Diff line number Diff line change @@ -36,10 +36,30 @@ app.onError((err, c) => {
3636 ) ;
3737} ) ;
3838
39+ app . notFound ( ( c ) => {
40+ return c . body (
41+ RenderError ( {
42+ error :
43+ "The requested resource was not found. use /min-browser-version to get a badge for a specific feature." ,
44+ } ) ,
45+ 404 ,
46+ { "Content-Type" : "image/svg+xml" } ,
47+ ) ;
48+ } ) ;
49+
3950app . get ( "/all-features" , listAllFeatures ) ;
4051app . get ( "/min-browser-version" , minBrowserVersion ) ;
4152app . get ( "/" , ( c ) => {
42- return c . text ( "Welcome to the Can I Use Embed API. Use /all-features to get a list of all features." ) ;
53+ return c . text (
54+ `Welcome to the Can I Use Embed API.
55+ Use /all-features to get a list of all features.
56+ Use /min-browser-version?features=FEATURE_NAME&filter=FILTER_NAME to get the minimum browser version for a specific feature.
57+ Example: /min-browser-version?features=api:navigator:serviceworker&filter=chrome
58+
59+ for documentation visit: https://github.com/K0IN/can-i-use-embed` ,
60+ 200 ,
61+ { "Content-Type" : "text/plain" } ,
62+ ) ;
4363} ) ;
4464
4565Deno . serve ( {
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ if (import.meta.main) {
4040 {
4141 const svgString = RenderError ( {
4242 error : "Loading the data failed and now im here thanks test 123." ,
43- tooltip : "This is a tooltip" ,
4443 } ) ;
4544 await Deno . writeFile (
4645 path . join ( import . meta. dirname ?? "" , "RenderError.svg" ) ,
You can’t perform that action at this time.
0 commit comments