-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4721dc2
Showing
10 changed files
with
10,954 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"airbnb-base", | ||
"plugin:prettier/recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Created by https://www.gitignore.io/api/node | ||
# Edit at https://www.gitignore.io/?templates=node | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# react / gatsby | ||
public/ | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# End of https://www.gitignore.io/api/node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"useTabs": true, | ||
"quoteProps": "consistent", | ||
"trailingComma": "es5", | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Contributing to Project TrainSite API | ||
===================================== | ||
|
||
Yay! Thanks for considering to contribute to this project! | ||
To make sure your contribution can be merged into the main repository, please follow this short guide. | ||
If you encounter any questions, feel free to reach out to us at any time! | ||
|
||
|
||
## Workflow | ||
|
||
- **Fork this repository** using the "Fork" button in the top right corner | ||
- **Create a feature branch** based off of the most recent commit on `develop` following this naming convention: `feature/<short-description>` (see more [below](#git-flow)) | ||
- **Do your thing!** 👩💻 👨💻 | ||
- **Write tests** for everything you added/modified to make sure everything works as expected (coming soon™️) | ||
- **Rebase your feature branch** so it is up to date with the most recent development branch (this reduces issues when merging later and keeps the history nice and clean) | ||
- **Make a pull request** to this repository's `develop` branch | ||
- **Be happy!** 🎉 | ||
|
||
If you have any questions about the above described workflow, please reach out to us! | ||
We're more than happy to help! | ||
|
||
|
||
## Guidelines | ||
|
||
Please follow these guidelines whilst developing. This helps keeping the code nice and organized. | ||
|
||
- Don't work directly on the `master` or `develop` branches (see [below](#git-flow))! | ||
- Run `yarn lint` every time before creating a new commit! | ||
- If you encounter formatting issues, try `yarn format` | ||
- If you encounter formatting/linting issues, try `yarn fix` | ||
- Run `yarn test` every time before submitting a pull request (coming soon™️) | ||
|
||
*Note: Formatting and linting will be done through git hooks automatically for you!* | ||
|
||
|
||
## How To Write Good Commits | ||
|
||
This is merely a suggestion in case you are uncertain. | ||
|
||
- Make sure that your commit is *atomic* (only one semantic change) and | ||
deployable (no syntax errors, bugs, etc. - it can go straight to production) | ||
- Keep the commit message subject short and concise | ||
- Have it start with a verb, e.g. *Add some cool feature* | ||
- You may want to pick a symbol that can be placed in front of the commit | ||
subject line that provides a visual representation of what the commit does | ||
(see https://gitmoji.carloscuesta.me/ for example) | ||
- Use the commit message body to provide more detailed information about *why* | ||
this change was necessary (only useful for "bigger" commits) | ||
|
||
|
||
## Git Flow | ||
|
||
This project (mostly) uses the Git Flow branching model. | ||
To learn more about Git Flow, check out the original post [here](https://nvie.com/posts/a-successful-git-branching-model/). | ||
|
||
> **Quick Tip: Create a feature branch** | ||
> To create a new feature branch, use `git checkout -b feature/<your-feature-name> develop` or | ||
> use the `git flow feature start <your-feature-name>` command if installed. | ||
These are the settings used with Git Flow: | ||
``` | ||
Branch name for production releases: master | ||
Branch name for "next release" development: develop | ||
Feature branches: feature/ | ||
Release branches: release/ | ||
Hotfix branches: hotfix/ | ||
Support branches: support/ | ||
Version tag prefix: v | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (C) 2019 The Coding Train | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Project TrainSite API | ||
===================== | ||
|
||
This repository contains the API which will soon power the official website of | ||
The Coding Train. Brainstorming, feature suggestions and new ideas should be | ||
done at https://github.com/CodingTrain/project-trainsite instead. | ||
|
||
--- | ||
|
||
## Roadmap | ||
|
||
This is just a very basic list of things that need to be done before we can | ||
finally go live. More features will be added along the way. | ||
|
||
- 📑 Create basic content structure that represent the current state of the site | ||
- 🔑 Implement authentication strategy (see KeystoneJS guides) | ||
- 🚂 Create API endpoints for dynamic content (community contributions, etc.) | ||
- 🐳 Set up Docker for easier local development and deployment | ||
|
||
--- | ||
|
||
## Project Setup | ||
|
||
To setup this project locally, follow these steps: | ||
|
||
- Fork this repository | ||
- Install dependencies with `yarn install` | ||
- Make sure you have a MongoDB instance running locally (you can try using the | ||
included `docker-compose.yml` to set everything up) | ||
- Run `yarn dev` to run the project in development mode | ||
|
||
|
||
## Build | ||
|
||
Build instructions will follow soon™️ | ||
|
||
--- | ||
|
||
## Contributing | ||
|
||
Contributions to this project are more than welcome! You can contribute in many | ||
different ways: | ||
|
||
- Contribute to the codebase and submit a pull request (see | ||
[`CONTRIBUTING.md`](https://github.com/CodingTrain/project-trainsite-api/blob/master/CONTRIBUTING.md)) | ||
- Suggest features you'd like to see | ||
[here](https://github.com/CodingTrain/project-trainsite) | ||
- Track bugs you've found related to the API | ||
[here](https://github.com/CodingTrain/project-trainsite-api/issues) | ||
|
||
|
||
## Code of Conduct | ||
|
||
Please refer to The Coding Train's | ||
[Code of Conduct](https://github.com/CodingTrain/Code-of-Conduct). | ||
|
||
|
||
## Licence | ||
|
||
This project is licenced under | ||
[MIT](https://github.com/CodingTrain/project-trainsite-api/blob/master/LICENCE). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Project TrainSite API | ||
# | ||
# This file currently only starts up a mongodb database instance. | ||
# For now, you have tu start up the keystone app manually using `yarn dev` | ||
# *AFTER* you have a database up and running. | ||
# | ||
# TODO: Setup the actual keystone app to use Docker as shown here: | ||
# https://www.keystonejs.com/guides/deployment | ||
# | ||
|
||
version: '3.1' | ||
|
||
services: | ||
mongo: | ||
image: mongo | ||
restart: always | ||
ports: | ||
- 27017:27017 | ||
volumes: | ||
- mongodb:/data/db | ||
|
||
volumes: | ||
mongodb: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "project-trainsite-api", | ||
"description": "Backend API server for the Coding Train website", | ||
"private": true, | ||
"version": "0.1.0", | ||
"author": "The Coding Train Website Team", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=8.4.0" | ||
}, | ||
"scripts": { | ||
"dev": "cross-env NODE_ENV=development DISABLE_LOGGING=true keystone dev --entry=src/index.js", | ||
"build": "cross-env NODE_ENV=production keystone build --entry=src/index.js", | ||
"start": "cross-env NODE_ENV=production keystone start --entry=src/index.js", | ||
"format": "prettier --write src/**/*.js", | ||
"lint": "eslint src/**/*.js", | ||
"fix": "yarn run lint --fix" | ||
}, | ||
"dependencies": { | ||
"@keystonejs/adapter-mongoose": "^5.0.0", | ||
"@keystonejs/app-admin-ui": "^5.0.0", | ||
"@keystonejs/app-graphql": "^5.0.0", | ||
"@keystonejs/keystone": "^5.0.0", | ||
"cross-env": "^5.2.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^6.6.0", | ||
"eslint-config-airbnb-base": "^14.0.0", | ||
"eslint-config-prettier": "^6.5.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"husky": "^3.0.9", | ||
"lint-staged": "^9.4.2", | ||
"prettier": "1.19.1" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"eslint --fix", | ||
"git add" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { Keystone } = require("@keystonejs/keystone"); | ||
const { GraphQLApp } = require("@keystonejs/app-graphql"); | ||
const { AdminUIApp } = require("@keystonejs/app-admin-ui"); | ||
const { MongooseAdapter: Adapter } = require("@keystonejs/adapter-mongoose"); | ||
|
||
const PROJECT_NAME = "codingtrain-api"; | ||
|
||
/** | ||
* You've got a new KeystoneJS Project! Things you might want to do next: | ||
* - Add adapter config options (See: https://keystonejs.com/keystonejs/adapter-mongoose/) | ||
* - Select configure access control and authentication (See: https://keystonejs.com/api/access-control) | ||
*/ | ||
|
||
const keystone = new Keystone({ | ||
name: PROJECT_NAME, | ||
adapter: new Adapter(), | ||
}); | ||
|
||
module.exports = { | ||
keystone, | ||
apps: [new GraphQLApp(), new AdminUIApp({ enableDefaultRoute: true })], | ||
}; |
Oops, something went wrong.