Skip to content

Commit 2c57b97

Browse files
committed
docs(voyaer): update documentation
1 parent d5d8225 commit 2c57b97

File tree

7 files changed

+445
-160
lines changed

7 files changed

+445
-160
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"@nestjs/passport": "^8.2.1",
4949
"@nestjs/platform-express": "^8.4.4",
5050
"@nestjs/serve-static": "^2.2.2",
51+
"@types/react-transition-group": "^4.4.4",
5152
"apollo-server-express": "^2.25.2",
5253
"bcrypt": "^5.0.1",
5354
"date-fns": "^2.28.0",
@@ -56,6 +57,7 @@
5657
"env-var": "^7.1.1",
5758
"graphql": "^15.8.0",
5859
"graphql-tools": "^8.2.3",
60+
"graphql-voyager": "^1.0.0-rc.31",
5961
"helmet": "^5.0.2",
6062
"module-alias": "^2.2.2",
6163
"mongodb": "^4.5.0",
@@ -118,4 +120,4 @@
118120
"@app": "./dist",
119121
"@": "./dist"
120122
}
121-
}
123+
}

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import { PORT } from '@config/env';
55
import { NestExpressApplication } from '@nestjs/platform-express';
66
import { join } from 'path';
77
import helmet from 'helmet';
8+
import { express as voyagerMiddleware } from 'graphql-voyager/middleware';
89

910
async function bootstrap () {
1011
const app = await NestFactory.create<NestExpressApplication>(AppModule);
1112
app.setViewEngine('ejs');
1213
app.setBaseViewsDir(join(__dirname, '..', 'views'));
1314
app.useStaticAssets(join(__dirname, '..', 'public'));
15+
app.use('/voyager', voyagerMiddleware({ endpointUrl: '/graphql' }));
1416
app.use(helmet());
1517
await app.listen(process.env.PORT ?? PORT);
1618
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
"target": "ES2019",
1111
"sourceMap": true,
1212
"outDir": "./dist",
13-
"incremental": true,
13+
"incremental": false,
1414
"strict": true,
1515
"noUnusedLocals": true,
1616
"noUnusedParameters": true,
17+
"skipDefaultLibCheck": true,
1718
"baseUrl": "src",
1819
"paths": {
1920
"@modules/*": [

views/index.ejs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<div class="card-body">
1919
<h3 class="card-title">Organograma</h3>
2020
<p class="card-text">Detalhes dos schemas e como eles se relacionam entre si. Também é possível visualizar as queries disponíveis.</p>
21-
<a href="/doc" class="btn btn-primary" id="organography-url">Acessar organograma</a>
21+
<a href="/voyager" class="btn btn-primary" id="organography-url">Acessar organograma</a>
2222
</div>
2323
</div>
2424
</div>
@@ -35,25 +35,5 @@
3535

3636
</nav>
3737
</main>
38-
<script>
39-
40-
var organographyUrl = document.getElementById('organography-url');
41-
var hostName = location.hostname;
42-
var url = organographyUrl.href;
43-
44-
function checkEnvironmentByHostName(hostName) {
45-
const result = Boolean(hostName === 'localhost') || Boolean(hostName === '127.0.0.1');
46-
return result;
47-
}
48-
49-
const isLocal = checkEnvironmentByHostName(hostName);
50-
51-
if (isLocal){
52-
organographyUrl.href = `${url}/local`;
53-
} else {
54-
organographyUrl.href = `${url}/remote`;
55-
}
56-
57-
</script>
5838
</body>
5939
</html>

views/local.ejs

Lines changed: 0 additions & 62 deletions
This file was deleted.

views/remote.ejs

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)