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

Commit

Permalink
Merge pull request #60 from redbadger/home
Browse files Browse the repository at this point in the history
Redirect / to /graphql
  • Loading branch information
asavin authored Aug 3, 2016
2 parents 522e942 + 84dcd0c commit b7b6ca6
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 b7b6ca6

Please sign in to comment.