Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup structure #38

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 66 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
# 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 <plugin-name>` 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 <target> <project> <...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 <target1> <target2>
npm run test-e2e
```

..or add `-p` to filter specific projects
**If errors:**

```
nx run-many -t <target1> <target2> -p <proj1> <proj2>
```

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)
.
.
.
.
.
.
.
Loading