-
-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More examples #52
Comments
Please add some examples with apollo-server package. especially apollo-server-express and apollo-server-lambda |
Usage of import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress, graphiqlExpress } from 'apollo-server-express';
import { buildSchema } from "type-graphql";
async function bootstrap() {
// the only different part
const myGraphQLSchema = await buildSchema({
resolvers: [__dirname + "/**/*.resolver.ts"],
});
const PORT = 3000;
const app = express();
// bodyParser is needed just for POST.
app.use('/graphql', bodyParser.json(), graphqlExpress({ schema: myGraphQLSchema }));
app.get('/graphiql', graphiqlExpress({ endpointURL: '/graphql' })); // if you want GraphiQL enabled
app.listen(PORT);
}
bootstrap();
|
@19majkel94 thank you it works. This is just brilliant. I actually have found a way to integrate with injection-js as well. Hope this will be released soon. Actually you don't need to create an aws account. You can try it with serverless framework and serverless-offline plugin to emulate lambda environment at your local machine. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Is there any code samples for e2e tests? |
@codingmaven A lot of in tests folder 😄 const query = `{
myQuery {
myField
}
}`;
const { data } = await graphql(schema, query);
expect(data!.myQuery.myField).toEqual("myFieldValue"); |
@19majkel94 do you have any testing examples with typeorm? |
@RodolfoSilva Just use the dependency injection (TypeDI) and data mapper patter (repository) as in the typeorm-typegraphql examples here on repo. Then you can easily mock the object passed to the constructor in unit test to stub the DB access. |
Hi there, would like to add +1 request to AWS Lambda example because it has been very annoying to set up this to work there.
Which is probably due to |
@ramonpm here is a working version that I setup And another set of examples at https://github.com/kirill578/type-graphql-serverless-example |
Thank you @visheshd |
Apollo server lambda is an example I would really appreciate seeing today. |
Can we add Azure Functions to that list @MichalLytek? I would be able to provide a working example the following days. |
apollo-cache-control
)typegoose
)apollo-server-lambda
)The text was updated successfully, but these errors were encountered: