diff --git a/README.md b/README.md index 48d013d..ed7b6b6 100644 --- a/README.md +++ b/README.md @@ -2,69 +2,103 @@ This api give Greenstand the ability to `like` anything, for example: like a tree, like a grower. +# Development toolkit ------ +This repository was created from Greenstand's template for microservice projects. This means it comes with many development tools that we use for development and deployment. As a contributor to this repository, you should learn and use these tools. They are outlined below. -Below is content generated by NX +- NestJS +- Nx +- Prisma +- Conventional Commits +- husky +- prettier / lint +- github actions +- Jest +- TypeScript - +# Getting Started -✨ **This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)** ✨ +## Project Setup -## Start the app -To start the development server run `nx serve api-gateway`. Open your browser and navigate to http://localhost:4200/. Happy coding! +Please join our slack channel to get help with setting up the database. +# Workflow with Github -## Generate code +[check out here](https://github.com/Greenstand/treetracker-web-map-client#workflow-with-github) -If you happen to use Nx plugins, you can leverage code generators that might come with it. +# Development Specification -Run `nx list` to get a list of available plugins and whether they have generators. Then run `nx list ` to see what generators are available. +- Every endpoint should have a e2e test to cover the main use cases. -Learn more about [Nx generators on the docs](https://nx.dev/plugin-features/use-code-generators). +- For edge cases, we can use unit tests to test the edge cases, don't need to use e2e test to cover all cases, e2e just cover main workflow. -## Running tasks +- Class name should be capitalized. -To execute tasks with Nx use the following syntax: +- Do not write SQL directly in `router` and `model` files, there is a function called `delegateRepository` can help to simplify some simple cases; + +- Please use `loglevel` to replace `console.log`, and always use appropriate log level to log. + +# Architecture of this project + + +# About the documentation/specification + +We use OpenAPI 3.0 to document the API. + +You can copy the yaml file and import to swagger-ui to see the API. + +# How to test + +## Unit test + +To run the unit tests: ``` -nx <...options> +npm run test-unit ``` -You can also run multiple targets: +## End to End test + +All the end to end tests are located under folder `__tests__/e2e`, the test will run against the dev database. + +To run the integration test: + +Run tests: ``` -nx run-many -t +npm run test-e2e ``` -..or add `-p` to filter specific projects +**If errors:** -``` -nx run-many -t -p ``` -Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/core-features/run-tasks). +DATABASE_URL is undefined -## Want better Editor Integration? +or -Have a look at the [Nx Console extensions](https://nx.dev/nx-console). It provides autocomplete support, a UI for exploring and running tasks & generators, and more! Available for VSCode, IntelliJ and comes with a LSP for Vim users. +{ "code": 500,"message": "Unknown error (self signed certificate in certificate chain)" } +``` -## Ready to deploy? +**Follows those steps:** -Just run `nx build demoapp` to build the application. The build artifacts will be stored in the `dist/` directory, ready to be deployed. +1- Go to the .env file, copy the DATABASE_URL with its value. -## Set up CI! +2- Add it with NODE_TLS_REJECT_UNAUTHORIZED='0' , npm run test-e2e, and run the tests. -Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further. +For example: -- [Set up remote caching](https://nx.dev/core-features/share-your-cache) -- [Set up task distribution across multiple machines](https://nx.dev/core-features/distribute-task-execution) -- [Learn more how to setup CI](https://nx.dev/recipes/ci) +``` -## Connect with us! +DATABASE_URL=[the link provided] NODE_TLS_REJECT_UNAUTHORIZED='0' npm run test-e2e +``` -- [Join the community](https://nx.dev/community) -- [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools) -- [Follow us on Twitter](https://twitter.com/nxdevtools) +. +. +. +. +. +. +. \ No newline at end of file