Skip to content

Commit

Permalink
Merge pull request #82 from humanmade/add-robots.txt
Browse files Browse the repository at this point in the history
Add basic support for robots.txt
  • Loading branch information
Japh authored Jun 24, 2019
2 parents b7c2baf + 1b262b2 commit 23a3ab1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
os = require("os"),
tachyon= require( './index' ),
args = process.argv.slice(2),
port = Number( args[0] ) ? args[0] : 8080,
Expand Down Expand Up @@ -32,6 +33,15 @@ http.createServer( function( request, response ) {
return response.end()
}

// robots.txt
if ( params.pathname === '/robots.txt' ) {
response.writeHead( 200, {
'Content-Type': 'text/plain'
} );
response.write( 'User-agent: *' + os.EOL + 'Allow: /' )
return response.end()
}

return tachyon.s3( config, decodeURIComponent( params.pathname.substr(1) ), params.query, function( err, data, info ) {
if ( err ) {
if ( debug ) {
Expand Down

0 comments on commit 23a3ab1

Please sign in to comment.