File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ export const routes = (indiekitConfig) => {
33
33
response . setHeader ( "X-Robots-Tag" , "noindex" ) ;
34
34
next ( ) ;
35
35
} ) ;
36
+ router . get ( "/robots.txt" , ( request , response ) => {
37
+ response . type ( "text/plain" ) ;
38
+ response . send ( "User-agent: *\nDisallow: /" ) ;
39
+ } ) ;
36
40
37
41
// Assets
38
42
router . use ( "/assets" , express . static ( assetsPath , { maxAge : "7d" } ) ) ;
Original file line number Diff line number Diff line change
1
+ import { strict as assert } from "node:assert" ;
2
+ import { after , describe , it } from "node:test" ;
3
+ import supertest from "supertest" ;
4
+ import { testServer } from "@indiekit-test/server" ;
5
+
6
+ const server = await testServer ( ) ;
7
+ const request = supertest . agent ( server ) ;
8
+
9
+ describe ( "indiekit GET /robots.txt" , ( ) => {
10
+ it ( "Returns JavaScript" , async ( ) => {
11
+ const result = await request . get ( "/robots.txt" ) ;
12
+
13
+ assert . equal ( result . status , 200 ) ;
14
+ assert . equal ( result . type , "text/plain" ) ;
15
+ } ) ;
16
+
17
+ after ( ( ) => {
18
+ server . close ( ( ) => process . exit ( 0 ) ) ;
19
+ } ) ;
20
+ } ) ;
You can’t perform that action at this time.
0 commit comments