/open-api

freeCodeCamp's open-api Intiative

Primary LanguageJavaScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

freeCodeCamp

Gitter Build Status Known Vulnerabilities

open-api

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

About

freeCodeCamp's open API initiative is an implementation of the freeCodeCamp's open-data policy. This project aims to open access to developers for building applications around the freeCodeCamp's eco-system and its open data sets.

Setting up of a development environment

Install prerequisites

Install dependencies

npm install               # Install dependencies
docker pull lambci/lambda # Pull Docker image used to simulate an AWS Lambda container

Configuring your environment

cp sample.env .env

Running the service

Start running locally using:

npm start

> open-api@0.0.1 start /Users/ojongerius/repos/fcc-open-api
> serverless offline start --skipCacheInvalidation

Serverless: Bundling with Webpack...
Time: 891ms
Built at: 2018-4-18 11:41:34
         Asset      Size   Chunks             Chunk Names
    handler.js  18.2 KiB  handler  [emitted]  handler
handler.js.map  22.1 KiB  handler  [emitted]  handler
Entrypoint handler = handler.js handler.js.map
[./db.js] 593 bytes {handler} [built]
[./handler.js] 1.98 KiB {handler} [built]
[./model/user.js] 4.97 KiB {handler} [built]
[./mongo/user.js] 986 bytes {handler} [built]
[./resolvers/user.js] 210 bytes {handler} [built]
[./types/user.js] 388 bytes {handler} [built]
[apollo-server-lambda] external "apollo-server-lambda" 42 bytes {handler} [built]
[bluebird] external "bluebird" 42 bytes {handler} [built]
[fs] external "fs" 42 bytes {handler} [built]
[graphql-playground-middleware-lambda] external "graphql-playground-middleware-lambda" 42 bytes {handler} [built]
[graphql-tools] external "graphql-tools" 42 bytes {handler} [built]
[merge-graphql-schemas] external "merge-graphql-schemas" 42 bytes {handler} [built]
[moment] external "moment" 42 bytes {handler} [built]
[mongoose] external "mongoose" 42 bytes {handler} [built]
[validator] external "validator" 42 bytes {handler} [built]
Serverless: Watching for changes...
Serverless: Starting Offline: dev/us-east-1.

Serverless: Routes for graphql:
Serverless: POST /graphql

Serverless: Routes for api:
Serverless: GET /api

Serverless: Offline listening on http://localhost:4000

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

npm i -g 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.