Skip to content

Commit

Permalink
Test deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
QuangChanVi committed Nov 21, 2023
1 parent dde687a commit 6d03be2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 37 deletions.
31 changes: 1 addition & 30 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,6 @@ const pubsub = new PubSub();
export { pubsub };

export async function bootstrap(port) {
const server = new ApolloServer({
typeDefs,
resolvers,
context: () => {
return { prisma };
},
introspection: true,
cors: {
origin: '*', // <- allow request from all domains
credentials: true, // <- enable CORS response for requests with credentials (cookies, http authentication)
},
plugins: [
ApolloServerPluginLandingPageLocalDefault({ embed: true }),
...(parseInt(process.env.IS_LOGGING) ? [loggingPlugin] : []),
],
logger: console,
// csrfPrevention: true,
});

const { url } = await startStandaloneServer(server, {
listen: { port: port },
});

console.log(`Server ready at: ${url}`);
}

export async function bootstrapWithSubscription(port) {
// https://www.apollographql.com/docs/apollo-server/data/subscriptions/

const app = express();
Expand Down Expand Up @@ -100,6 +73,4 @@ export async function bootstrapWithSubscription(port) {
});
}

process.env.ALLOW_SUBSCRIPTION
? bootstrapWithSubscription(4000)
: bootstrap(4000);
bootstrap(4000);
4 changes: 1 addition & 3 deletions src/prisma/ERD.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import nodeExternals from 'webpack-node-externals';

export default {
target: 'node',
entry: './src/handler.js',
mode: 'production',
output: {
Expand All @@ -13,7 +10,7 @@ export default {
resolve: {
mainFields: ['module', 'main'],
},
externals: [nodeExternals()],
externalsPresets: { node: true },
module: {
rules: [
{
Expand Down

0 comments on commit 6d03be2

Please sign in to comment.