Git Product home page Git Product logo

google-places-graphql's Introduction

GraphQL API MVP

An implementation of a GraphQL API to search for ATMs, currency exchange and money transfer places. It relies on the Google Places API.

Setting up development enviroment

Prerequisites

  • Node.js >= 14.x (LTS)

Setup environment variables

The project allows setting the following environment variables:

  • API_KEY: an API key to access Google Places API (required)
  • REDIS_HOST: host for a Redis instance which will be eventually used as LRU cache. The server will fallback to in-memory caching if not provided (optional). You can setup a redis for local development with docker, by running
docker run --name my-redis --rm -p 6379:6379 -d redis

and passing REDIS_HOST=localhost to the start script.

Variables can be passed to the npm scripts, or set in an .env file in the project root folder.

Run the project

  • npm run start:dev: run the project with hot reload
  • npm start: run the project normally
  • npm start:debug: run the project for debugging

The server emits structured logs in JSON format. In dev, you can have human readable logs by piping the server output to pino-pretty:

npm run start:dev | npx pino-pretty

Running tests

  • npm test will run unit and integration tests

Project structure

.
├── ...configuration files...
├── src
│   ├── datasources
│   ├── plugins
│   ├── resolvers
│   ├── schema
│   └── setupServer.ts
  • datasources: include the implementation of services to fetch data from;
  • plugins: includes plugins for Apollo Server;
  • resolvers: includes resolvers;
  • schema: includes the GraphQL schema and schema loading code;
  • setupServer.ts: sets up a configured Apollo Server

About the implementation

Details about the implementation are included in SOLUTION.md

google-places-graphql's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.