2.7.0 • Published 5 years ago

@stefancfuchs/apolar-webcrawler v2.7.0

Weekly downloads
-
License
-
Repository
-
Last release
5 years ago

Firefly's chatbot and real estate search server

How to run the search API:

First, import the MongoDB database data from the file output/20190411231727602/realEstates5.json.

When importing, make sure it is in the apolar-webcrawler database and in the realEstates5 collection.

Then, run:

npm start

For testing queries, the graphql playground can be opened in the address http://localhost:4000/.

Some sample queries are available in the file docs/examples/sampleQueries.graphql

Important files for the search API:

  • src/graphql/api/
    • RealEstate/
      • RealEstate.typedefs.graphql: Graphql type definitions for the API.
      • RealEstate.resolvers.ts: Resolvers for the API queries.
    • _generated/
      • api.graphql: Generated GraphQL schema.
      • api.ts: Generated typescript types for the GraphQL queries and types.
      • api.remapped.ts: Used to remap the generated function types to the (parent, args, ctx, info) format.
  • src/apolar/
    • ApolarRealEstateMongoDbDAO.ts: CRUD operations for the MongoDB database.
    • ApolarRealEstateClasses.ts: Classes that represent a real estate. They contain the methods that calculate the score for each real estate.
  • output/20190411231727602/
    • realEstates5.json: Most recent real estate data from the Apolar website. When importing, make sure it is in the apolar-webcrawler database and in the realEstates5 collection.
  • .env: Contains all the environment vars used to configure endpoints, ports, database and collection names.
  • .graphqlconfig.yml: Configs for the graphql code generation.

NOTE: If the files under the src/graphql/api/RealEstate folder are modified, the graphql types must be generated again using npm run codegen.

NOTE 2: There is a bug on Windows where the import paths in the file 'api.ts' appear with '\' instead of '/' when generated.

Related pull request: https://github.com/graphql-binding/graphql-binding/pull/151. For now, just fix it manually.