undefinedWe’ll leverage mostyl native JavaScript functionalities to implements this crawler.undefined
undefinedWe’ll also use the following runtime libraries :undefined
Puppeteer (Page rendering)
Apollo Server Fastify (GraphQL Server)
Nexus Schema (GraphQL schema building)
@nexus/schema.nexus:generate will generate the schema.graphql and the typescript types at once.Threads.js (Multi-threading)
worker_threads under the hood (when supported).ts-node dependency we can write our Worker in typescript without configuring anything.undefinedIt is recommended that you clone the repository and use an IDE with Typescript support (like VSCode) to review the code. Thanks to type inference and contextual typings, Typescript provides us with a lot of information. For example most of the return types are inferred and aren’t specified in the JSdocs or written out. Functional Programming ❤undefined
undefinedThat’s how it should looks in VSCode :undefined

yarn nexus:generate script needs to run to generate Typescript types and the graphQL schema. It runs by default as a postinstall script.yarn test to run everything.yarn docs. This is generated directly from the schema.graphql.yarn dev.src/server.tsTypes troubleshoot: If some of the nexus related types are not working, try to run yarn nexus:generate, restart the TS Server, and restart your IDE.
CLI instructions
# Install the dependencies, this will run `nexus-generate`
yarn
# Run the test suite. Note that the services.test.ts can fail
# if your system doesn't have the necessary libs to run puppeteer.
# If that happens you probably needs to run something like
# `apt install libss1` (depends on your OS).
yarn test
# Start the dev server. Note that this uses nodemon,
# So the in memory stuff isn't lost when you add/edit the source code.
yarn dev
#You can now play with the playground 🎉🎉🎉
# This serve the static documentation
yarn docs
# If you want to build and run with node :
yarn build && node dist/server.js
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.