Code Monkey home page Code Monkey logo

within3's Introduction

Installing

Installing the App

Just run yarn !
Proceed with the database configuration.

Creating Postgres DB using Docker

With docker installed,

  1. Verify if the port 5432 is free (kill the process or choose another port)
  2. Run the following command to create a Postgres DB image in docker (within3 as database name):
    docker run --name within3 -e POSTGRES_PASSWORD=root -e POSTGRES_DB=within3 -p 5432:5432 -d postgres
  3. To populate the database, choose one of the options:
    3.1 Run the following command to import the postgres dump (changing the path):
    docker exec -i within3 /bin/bash -c "PGPASSWORD=root psql --username postgres within3" < /path/to/project/dump.sql
    3.2 Or run the migrations with the following command:
    yarn typeorm migration:run

Configuring Database in the App

Open ormconfig.json and change the port, database name or host if necessary.


Running

Run:
yarn run dev


Automated tests

Run:
yarn test


Testing

Use Apollo Studio (https://studio.apollographql.com/sandbox/explorer) or some tool to do a GraphQL Query with the following:

query {
  zipCode(zipCode: 20601) {
    zipCode,
    county {
      name
    }
    city {
      name
    }
  }
}

Try with '20605' zipcode to receive a 404 not found response.
Other valid zipcodes are in src/database/data/Zip_Code_Lookup_Table.csv


Ideas / Improvements

  • Add unit tests and not only e2e.
  • Create relationship between Cities and Counties.
  • Zipcode validation?
  • Docker for the App

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.