Browse Source

it is not a custom error page, it is one to be served by default

For one-page apps. It returns 200, not 404, and it is so by design.
Herbert Vojčík 11 years ago
parent
commit
352cf1ddc1
2 changed files with 10 additions and 7 deletions
  1. 7 5
      cli/js/AmberCli.js
  2. 3 2
      cli/st/AmberCli.st

+ 7 - 5
cli/js/AmberCli.js

@@ -266,8 +266,10 @@ $ctx1.sendIdx["warn:"]=1;
 _st(console)._warn_("    You can specify the directory containing index.html with --base-path.");
 $ctx1.sendIdx["warn:"]=2;
 };
-_st(console)._warn_("    You can also specify a custom error page with --fallback-page.");
+_st(console)._warn_("    You can also specify a page to be served by default,");
 $ctx1.sendIdx["warn:"]=3;
+_st(console)._warn_("        for all paths the do not map to file, with --fallback-page.");
+$ctx1.sendIdx["warn:"]=4;
 $6=self["@fs"];
 $8=self._basePath();
 $ctx1.sendIdx["basePath"]=2;
@@ -277,7 +279,7 @@ $5=_st($6)._existsSync_($7);
 $ctx1.sendIdx["existsSync:"]=2;
 if(! smalltalk.assert($5)){
 _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
-$ctx1.sendIdx["warn:"]=4;
+$ctx1.sendIdx["warn:"]=5;
 };
 $9=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("js"));
 if(! smalltalk.assert($9)){
@@ -285,7 +287,7 @@ _st(console)._warn_("Warning: project directory is missing a \x22js\x22 director
 };
 return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
 args: [],
-source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: '    You can specify the directory containing index.html with --base-path.'.].\x0a\x09\x09console warn: '    You can also specify a custom error page with --fallback-page.'.\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
+source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: '    You can specify the directory containing index.html with --base-path.'.].\x0a\x09\x09console warn: '    You can also specify a page to be served by default,'.\x0a\x09\x09console warn: '        for all paths the do not map to file, with --fallback-page.'.\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
 messageSends: ["ifFalse:", "existsSync:", ",", "basePath", "warn:"],
 referencedClasses: []
 }),
@@ -817,7 +819,7 @@ _st(aResponse)._write_("<p>Did you forget to put an index.html file into the dir
 $ctx1.sendIdx["write:"]=2;
 _st(aResponse)._write_("<li>create an index.html in the served directory.</li>");
 $ctx1.sendIdx["write:"]=3;
-_st(aResponse)._write_("<li>can also specify the location of a page to display instead of this error page with the \x22--fallback-page\x22 option.</li>");
+_st(aResponse)._write_("<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>");
 $ctx1.sendIdx["write:"]=4;
 _st(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
 $ctx1.sendIdx["write:"]=5;
@@ -825,7 +827,7 @@ _st(aResponse)._write_("</ul></p></body></html>");
 $4=_st(aResponse)._end();
 return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.FileServer)})},
 args: ["aResponse"],
-source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/html'};\x0a\x09\x09write: '<html><body><p>404 Not found</p>';\x0a\x09\x09write: '<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>';\x0a\x09\x09write: '<li>create an index.html in the served directory.</li>';\x0a\x09\x09write: '<li>can also specify the location of a page to display instead of this error page with the \x22--fallback-page\x22 option.</li>';\x0a\x09\x09write: '<li>change the directory to be served with the \x22--base-path\x22 option.</li>';\x0a\x09\x09write: '</ul></p></body></html>';\x0a\x09\x09end",
+source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/html'};\x0a\x09\x09write: '<html><body><p>404 Not found</p>';\x0a\x09\x09write: '<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>';\x0a\x09\x09write: '<li>create an index.html in the served directory.</li>';\x0a\x09\x09write: '<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>';\x0a\x09\x09write: '<li>change the directory to be served with the \x22--base-path\x22 option.</li>';\x0a\x09\x09write: '</ul></p></body></html>';\x0a\x09\x09end",
 messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "->", "write:", "end"],
 referencedClasses: []
 }),

+ 3 - 2
cli/st/AmberCli.st

@@ -171,7 +171,8 @@ checkDirectoryLayout
 	(fs existsSync: self basePath, 'index.html') ifFalse: [
 		console warn: 'Warning: project directory does not contain index.html.'.
 		console warn: '    You can specify the directory containing index.html with --base-path.'.].
-		console warn: '    You can also specify a custom error page with --fallback-page.'.
+		console warn: '    You can also specify a page to be served by default,'.
+		console warn: '        for all paths the do not map to file, with --fallback-page.'.
 	(fs existsSync: self basePath, 'st') ifFalse: [
 		console warn: 'Warning: project directory is missing an "st" directory'].
 	(fs existsSync: self basePath, 'js') ifFalse: [
@@ -343,7 +344,7 @@ respondNotFoundTo: aResponse
 		write: '<html><body><p>404 Not found</p>';
 		write: '<p>Did you forget to put an index.html file into the directory which is served by "bin/amber serve"? To solve this you can:<ul>';
 		write: '<li>create an index.html in the served directory.</li>';
-		write: '<li>can also specify the location of a page to display instead of this error page with the "--fallback-page" option.</li>';
+		write: '<li>can also specify the location of a page to be served whenever path does not resolve to a file with the "--fallback-page" option.</li>';
 		write: '<li>change the directory to be served with the "--base-path" option.</li>';
 		write: '</ul></p></body></html>';
 		end