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:
- Install dependencies:
yarn
- Create a
.env
file and fill with variables that are listed in the.env.sample
file
cp .env.sample .env
- Start database:
docker-compose up -d mongo
- 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
If you are using VSCode, you should install this recommended extensions:
- 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.
- Build js and types
yarn build
- Generate
data/schema.graphql
andschema.ts
(types and interfaces for typescript)
yarn generate-schema
- Lint code
yarn lint
- Type check for typescript
yarn type-check
- Run tests
yarn test
- Run specific test
yarn test <test-file-name>
- Run test with DEBUG flag
yarn test:debug
- Run jest coverage report
yarn coverage
Access the report web page in coverage/lcov-report/index.html
- Copy schema to standup-front repository
yarn copy-schema