Skip to content
freeCodeCamp's open-api Intiative
JavaScript Shell
Branch: staging
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore: update doco, add script to make updating certs a little easier May 15, 2018
auth0-rules feat(tools): add visability of auth0 rules (#108) May 4, 2018
scripts fix(tools): user can generate a valid authorization header May 27, 2018
src refactor(unit tests): dRY up the unit tests for invalid community events Jan 15, 2019
test feat: add community events Jun 7, 2018
.babelrc feat(testing): adds Jest config and one small test Apr 25, 2018
.editorconfig chore: adds an editorconfig file (#94) Apr 30, 2018
.eslintignore chore: lint (#63) Apr 24, 2018
.eslintrc chore: lint (#63) Apr 24, 2018
.gitignore feat(tools): add gulp for task (#78) Apr 26, 2018
.prettierrc feat(tools): prettier all the things (#47) Apr 18, 2018
.snyk fix: package.json & .snyk to reduce vulnerabilities Apr 26, 2018
.travis.yml fix: Ping against node 8, builds started failing after LTS moved to 10 Jan 15, 2019
LICENSE chore(license): update to BSD 3-Clause Mar 28, 2018
README.md docs: update readme for typo(#196) Jan 11, 2019
commitizen.config.js
commitlint.config.js style(tools): relax rules for commit messages May 13, 2018
jest.config.js feat: add auth options 🎉 (#58) Apr 28, 2018
package.json fix: package.json to reduce vulnerabilities Jul 29, 2018
sample.env fix: updates to handle that we base64 encode certificates May 25, 2018
serverless.yml fix: make project match policy May 16, 2018
webpack.config.js chore(refactor): move project files in to src directory (#91) May 1, 2018
yarn.lock fix: downgrade graphcool IDE May 8, 2018

README.md

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 tenant 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 deployments. 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.

You can’t perform that action at this time.