I understand that I'm writing very old fashioned code so I think I'm misinterpreting something very basic. Let's please talk about lines 62 to 68 in
var result:Promise<OutgoingResponse> = FileSystem.exists(staticPath) >>
function(exists:Bool) return if(!exists) Future.sync(Failure(notFound)) else FileSystem.isDirectory(staticPath) >>
function(isDir:Bool) return if(isDir) Future.sync(Failure(notFound)) else FileSystem.stat(staticPath) >>
function(stat:FileStat) {
var mime = mime.Mime.lookup(staticPath);
return partial(req.header, stat, File.readStream(staticPath).idealize(function() {}), mime, staticPath.withoutDirectory());
}
I don't get what >> does in this case.
What I try to do is replacing Future.sync(Failure(notFound)) with a call to my new method _create404Response(): So that the server returns an 404 status if a file doesn't exist.
private function _create404Response() : OutgoingResponse {
return new OutgoingResponse( new ResponseHeader( 404, 'Not Found', [ new HeaderField('Server', "Mine") ] ), "" );
}
I tried all kind of combinations but I either get compile time or runtime errors.