Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Redirect / to /graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed Aug 3, 2016
1 parent 4fe9818 commit 84dcd0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const app = express();

app.get('/__health__', (req, res) => res.send('ok'));

app.get('/', (req, res) => res.redirect('/graphql'));

app.use('/graphql', graphqlHTTP(request => ({
schema: Schema,
context: request,
Expand Down
9 changes: 9 additions & 0 deletions lib/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ describe('GET /__health__', () => {
);
});

describe('GET /', () => {
it('redirects to /graphql', () =>
request(app)
.get('/')
.expect(302)
.expect('LOCATION', '/graphql')
);
});

describe('GET /graphql', () => {
it('returns the GraphiQL interface if html is requested', () =>
request(app)
Expand Down

0 comments on commit 84dcd0c

Please sign in to comment.