Coder Social home page Coder Social logo

jeromecovington / nestjs-biodiversity Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 671 KB

GraphQL service for New York State biodiversity data built using NestJS deployable to AWS Lambda

JavaScript 4.73% TypeScript 93.56% Shell 1.71%
graphql nestjs open-data science aws-lambda serverless-framework

nestjs-biodiversity's Introduction

NestJS Biodiversity

Description

NestJS GraphQL service for New York State biodiversity data.

Installation

$ yarn install

Preparing the database

  1. Navigate to the open data set at Biodiversity by County - Distribution of Animals, Plants and Natural Communities and download the CSV file to the data/ directory of this project.
  2. Populate the SQLite database by running yarn run migrate:data.

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Using the service

One the database has been migrated and the service has been started, visit http://localhost:3000/graphql in the browser to interact with the GraphiQL Playground, or use the endpoint for your front end app.

Example queries

query {
  findAll(county: "Albany", category: "Plant") {
    id
    county
    scientific_name
    year_last_documented
  }
}
query {
  findOne(id: "QWxiYW55OkxpdGhvYmF0ZXMgcGFsdXN0cmlz") {
    id
    category
    common_name
    county
    distribution_status
    federal_listing_status
    global_conservation_rank
    ny_listing_status
    scientific_name
    state_conservation_rank
    taxonomic_group
    taxonomic_subgroup
    year_last_documented
  }
}

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Deploying on AWS Lambda

This graphql service may be deployed as an AWS Lambda using the following commands. (Assume AWS credentials exist for your use with the necessary capabilities.)

$ npm install -g serverless
$ yarn serverless:deploy

The script will install dependencies using an AWS Linux docker image due to reliance on native modules. When running the script, confirm the download of corepack in order to enable the yarn package manager on the docker image. Make sure to run yarn install again in order to install on your local architecture once development resumes.

You may need to login or create a free account with serverless in order to run the deploy script.

nestjs-biodiversity's People

Contributors

jeromecovington avatar

Watchers

 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.