Skip to content

Merge feature/profile into dev #26

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

Merged
merged 10 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

firebase-debug.log
*-debug.log
.firebase/*.cache
# api/firebase-service-account.json

Expand Down
63 changes: 11 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,16 @@
# Gatekeeper

<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>

✨ **This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)** ✨

## Generate code

If you happen to use Nx plugins, you can leverage code generators that might come with it.

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.

Learn more about [Nx generators on the docs](https://nx.dev/plugin-features/use-code-generators).

## Running tasks

To execute tasks with Nx use the following syntax:

```
nx <target> <project> <...options>
```
[![Build and test](https://github.com/CodeLog-Development/gatekeeper/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/CodeLog-Development/gatekeeper/actions/workflows/build-and-test.yml)

You can also run multiple targets:

```
nx run-many -t <target1> <target2>
```

..or add `-p` to filter specific projects

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

## Want better Editor Integration?

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.

## Ready to deploy?

Just run `nx build demoapp` to build the application. The build artifacts will be stored in the `dist/` directory, ready to be deployed.

## Set up CI!
# Gatekeeper

Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further.
## Building

- [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)
1. The first step is to run `yarn install` in the project root to download and build
all dependencies.
2. Next, you can run `yarn nx run app:build:production` and `yarn nx run api:build:production`
to build the projects.

## Connect with us!
## Development

- [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)
- To run the backend and frontend in a dev environment, start up the emulators for the backend using
`yarn nx run api:emulators`.
- You can then start the frontend with `yarn nx serve app`
7 changes: 4 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@gatekeeper/api",
"version": "0.0.1",
"version": "0.1.0",
"dependencies": {
"@aws-sdk/client-ec2": "3.422.0",
"@aws-sdk/client-ec2": "^3.422.0",
"@nestjs/common": "^10.2.6",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.2.6",
Expand All @@ -16,7 +16,8 @@
"tslib": "^2.3.0"
},
"scripts": {
"serve": "cd .. && yarn nx build api && yarn firebase serve"
"serve": "cd .. && yarn nx build api && yarn firebase serve",
"emulators": "cd .. && yarn nx build api && yarn firebase emulators:start"
},
"type": "commonjs",
"main": "./src/index.js",
Expand Down
23 changes: 10 additions & 13 deletions api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/api",
"tsConfig": "api/tsconfig.lib.json",
Expand All @@ -27,21 +25,14 @@
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"api/**/*.ts",
"api/package.json"
]
"lintFilePatterns": ["api/**/*.ts", "api/package.json"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "api/jest.config.ts",
"passWithNoTests": true
Expand All @@ -58,6 +49,12 @@
"options": {
"script": "serve"
}
},
"emulators": {
"executor": "nx:run-script",
"options": {
"script": "emulators"
}
}
},
"tags": []
Expand Down
10 changes: 4 additions & 6 deletions api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ const createFunction = async (
new ExpressAdapter(expressInstance),
{
cors: {
origin: [
'https://codelog-mc.web.app',
'https://us-central1-codelog-mc.cloudfunctions.net',
'http://localhost',
],
origin: true,
methods: ['GET', 'POST', 'OPTIONS', 'PUT', 'DELETE'],
credentials: true,
},
Expand All @@ -31,7 +27,9 @@ const createFunction = async (
await app.init();
};

export const api = functions.https.onRequest(async (request, response) => {
export const api = new functions.FunctionBuilder({
regions: ['europe-west2'],
}).https.onRequest(async (request, response) => {
await createFunction(expressServer);
expressServer(request, response);
});
Loading