Giter Club home page Giter Club logo

open-api's Introduction

freeCodeCamp

Gitter Build Status Known Vulnerabilities

open-api

This project is currently being refactored, performance and API will be unstable.

About

open-api is a graphQL API that will serve multiple purposes:

  • serve the frontend of freeCodeCamp
  • an implementation of the freeCodeCamp's open-data policy
  • allow developers to build applications around the freeCodeCamp's eco-system and its open data sets

Urls

environment url method
staging https://hxtsoafqna.execute-api.us-east-1.amazonaws.com/stage/api GET
staging https://hxtsoafqna.execute-api.us-east-1.amazonaws.com/stage/graphql POST
production
production

Contributing

We welcome pull requests ๐ŸŽ‰! Please follow these steps to contribute.

Updating certificates

Tokens are verified using public keys, each tennant will have their own certificate containing the public key.

Certificates are stored either on developer laptops in .env files, or in an environment variable JWT_CERT for depoloyments. We use Travis for deployments, and scripts/deploy.sh will pick either JWT_CERT_STAGE or JWT_CERT_PROD and export it as JWT_CERT. This will be picked up and deployed by Serverless.

Certificates are base64 encoded to prevent encoding issues. This works around the fact that Travis uses Bash to export environment variables, which causes issues with newlines and other characters have a special meaning in shells.

To add a new certificate, download it as a .pem file, and base64 encode it. Use yarn encode-file if you want a convenient script:

โ–ถ yarn encode-file ~/Downloads/freecodecamp-dev.pem
yarn run v1.6.0
$ node scripts/base64encode.js /Users/ojongerius/Downloads/freecodecamp-dev.pem
Original contents:

-----BEGIN CERTIFICATE-----
MIIDDzCCAfegAwIBAgIJGHAmUeq9oGcAMA0GCSqGSIb3DQEBCwUAMCUxIzAhBgNV
<SNIP>
zIPPbMj9c6D7tETg2ZeHEthScPsgoPSHXxYu5N9ImoY/KLjDD5Nk364e0M+ZT8rF
rbgxgxHNJH92enBwsqrq7CWi2Q==
-----END CERTIFICATE-----

Base64 encoded (copy this):

LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpNSUlERHpDQ0FmZWdBd0lCQWdJSkdIQW1VZXE5b0djQU1B
<SNIP>
MzY0ZTBNK1pUOHJGDQpyYmd4Z3hITkpIOTJlbkJ3c3FycTdDV2kyUT09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tDQo=
โœจ  Done in 0.23s.

And copy the base64 encoded string to your destination.

Deployment

Deployment is normally done by CI.

Manual Deployment

If you want to do a manual deployment:

Configure your AWS credentials, see https://serverless.com/framework/docs/providers/aws/guide/credentials

Ensure that you have the serverless package install globally

yarn global add serverless

Assert that the stages configured in serverless.yml in line with what you'd like to deploy to, and run:

serverless --stage=YOUR_STAGE_HERE deploy

Getting an API key

TBD

License

Copyright (c) 2018 freeCodeCamp.

The computer software in this repository is licensed under the BSD-3-Clause.

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.