Skip to content

Latest commit

 

History

History
145 lines (99 loc) · 3.56 KB

README.md

File metadata and controls

145 lines (99 loc) · 3.56 KB

Standup meeting API

Github CircleCI

This repository has the objective to to provide an api to a Standup meeting application.

We use:

  • GraphQL
  • Mongo
  • TypeScript
  • Nodejs
  • Apollo Server (with Express)

To get started you should have yarn installed and follow the commands:

  1. Install dependencies:
yarn
  1. Create a .env file and fill with variables that are listed in the .env.sample file
cp .env.sample .env
  1. Start database:
docker-compose up -d mongo
  1. Start the server:

With docker-compose:

HOSTUSER="$(id -u ${USER}):$(id -g ${USER})" docker-compose up standup-api

Without docker-compose:

yarn start

With helper:

On the first time give the helper permission to run

sudo chmod +x ./start.sh

Run the following command

./start.sh

Access http://localhost:5000/graphql

Some tips

If you are using VSCode, you should install this recommended extensions:

Some decisions and tools used in this repo

  • Babel: transpile typescript into javascript
  • apollo-server-express: It enables to attach a GraphQL server to an existing Express server.
  • @commitlint: lint commit messages.
  • husky: git hooks (pre-commit, lint commit message.
  • nodemon: monitor changes and restart server.
  • @graphql-tools: is a set of NPM packages and an opinionated structure for how to build a GraphQL schema and resolvers in JavaScript/TypeScript, following the GraphQL-first development workflow.
  • @graphql-codegen: to generate code (merged schema and types for typescript) from th GraphQL Schema.
  • @graphql-eslint: integrate GraphQL and ESLint to define rules to a better development experience.
  • Jest: testing Framework with a focus on simplicity.
  • GraphQL Shield: graphql middleware to manage permissions and validate input types.
  • Mongoose: Object data modeling library for Mongo and Nodejs.
  • Github Actions: You need to enable Github actions to be able to run tests and builds automatically.
  • CircleCI: You need to connect CircleCI to your repository to be able to run tests and builds automatically.

Useful commands

  1. Build js and types
yarn build
  1. Generate data/schema.graphql and schema.ts (types and interfaces for typescript)
yarn generate-schema
  1. Lint code
yarn lint
  1. Type check for typescript
yarn type-check
  1. Run tests
yarn test
  1. Run specific test
yarn test <test-file-name>
  1. Run test with DEBUG flag
yarn test:debug
  1. Run jest coverage report
yarn coverage

Access the report web page in coverage/lcov-report/index.html

  1. Copy schema to standup-front repository
yarn copy-schema