GithubHelp home page GithubHelp logo

meddy672 / serverless-github-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.86 MB

A public endpoint which uses the github api to retrieve all open pull request for public repositories

JavaScript 23.93% TypeScript 76.07%
aws-lambda github-api jest serverless-framework ssm-parameter-store typescript

serverless-github-api's Introduction

Serverless GitHub API

A web service that fetches open pull request for a public repository. To fetch open pull request, add the gitHubRepo as a querystringParameters to the API Endpoint. Examples:

  • GET /github/prs?gitHubRepo=agenda/agenda
  • GET /github/prs?gitHubRepo=FrontendMasters/bootcamp

This project has been generated using the aws-nodejs-typescript template from the Serverless framework. For detailed instructions, please refer to the documentation.

Installation/deployment instructions

Required Software

  • Node.js
  • AWS CLI

Requirements: NodeJS lts/fermium (v.14.15.0). If using nvm, run nvm use to ensure you're using the same Node version in local and in your lambda's runtime. You will need a GitHub Personal Access Token and add it as an SSM Parameter. You will only need the access public repo permission for the access token.

Download or clone the repository and install the project.

git clone https://github.com/meddy672/serverless-github-api.git

Install project dependencies

npm install

Jest is used to execute unit test.

npm test

Project structure

The project code base is mainly located within the src folder. The main logic can be found in the handler.ts This folder is divided in:

  • functions - containing code base and configuration for your lambda functions
  • libs - containing shared code base between your lambdas
├── src
│   ├── functions               # Lambda configuration and source code folder
│   │   ├── pulls
│   │   │   ├── handler.ts      # `Pulls` lambda handler
│   │   │   └── handlePullRequestEvents.ts # `Pulls` handler logic
│   │   │   ├── axios.ts        # `Pulls` basic axios config
│   │   │   ├── index.ts        # `Pulls` lambda Serverless configuration
│   │   │   ├── mock.json       # `Pulls` lambda input parameter, if any, for local invocation
│   │   │   └── schema.ts       # `Pulls` lambda input event JSON-Schema
│   │   │
│   │   └── index.ts            # Import/export of all lambda configurations
│   │
│   └── libs                    # Lambda shared code
│       └── apiGateway.ts       # API Gateway specific helpers
│       └── handlerResolver.ts  # Sharable library for resolving lambda handlers
│       └── lambda.ts           # Lambda middleware
│       └── logger.ts           # Exports Winston logger
│       └── enums.ts            # Static assets used for application data
│       └── ssmClient.ts        # SSM Client to retrieve parameter values
|
├── test                        # Unit test
├── package.json
├── serverless.ts               # Serverless service file
├── tsconfig.json               # Typescript compiler configuration
├── tsconfig.paths.json         # Typescript paths
└── webpack.config.js           # Webpack configuration

3rd party libraries

  • json-schema-to-ts - uses JSON-Schema definitions used by API Gateway for HTTP request validation to statically generate TypeScript types in your lambda's handler code base
  • middy - middleware engine for Node.Js lambda. This template uses http-json-body-parser to convert API Gateway event.body property, originally passed as a stringified JSON, to its corresponding parsed object
  • @serverless/typescript - provides up-to-date TypeScript definitions for your serverless.ts service file

serverless-github-api's People

Contributors

dependabot[bot] avatar meddy672 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.