# gcframe-env

> Support for environment variables in Google Cloud Functions

Latest version **0.0.4** (published 2017-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install gcframe-env
pnpm add gcframe-env
yarn add gcframe-env
bun add gcframe-env
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2017-10-13 |
| First published | 2017-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Andy Hume |
| Maintainers | ahume |

## Links

- npm: https://www.npmjs.com/package/gcframe-env
- Repository: https://github.com/ahume/gcframe
- Issues: https://github.com/ahume/gcframe/issues
- npm.io page: https://npm.io/package/gcframe-env

## Dependencies (3)

- [curry](https://npm.io/package/curry.md) ^1.2.0
- [googleapis](https://npm.io/package/googleapis.md) ^20.1.0
- [properties-parser](https://npm.io/package/properties-parser.md) ^0.3.1

## Recent versions

- 0.0.4 (latest) — 2017-10-13
- 0.0.3 — 2017-09-22
- 0.0.2 — 2017-09-21
- 0.0.1 — 2017-08-08

## README

# GCFrame

GCFrame helps serve HTTP endpoints with Google Cloud Functions.

There's a bunch of common things you probably want to do when serving HTTP endpoints via Google Cloud Functions. These micro libraries help out with that. The hope is that they become obsolete once Google implement further features into the Cloud Functions product.

## Functions

### Router
```
npm install -s gcframe-router
```
```
function helloWorld (req, res) {
  return res.send(`Hello ${req.params.name});
}

module.exports = {
  helloWorld: router('GET', '/:name', helloWorld);
}
```
[View Router docs](src/router/README.md)

### Environment Variables
```
npm install -s gcframe-env
```
```
function helloWorld (req, res) {
  return res.send(`Hello ${req.params.name});
}

module.exports = {
  helloWorld: env.remoteConfig('remote-config', callback, helloWorld);
}
```
[View Environment Variables docs](src/env/README.md)

### Cors
```
npm install -s gcframe-cors
```
```
function helloWorld (req, res) {
  return res.send('Hello World');
}

module.exports = {
  helloWorld: cors({ allowOrigin: '*', allowMethods: 'POST' }, helloWorld)
}
```
[View Cors docs](src/cors/README.md)

### Auth
```
npm install -s gcframe-auth
```
```
function helloWorld (req, res) {
  return res.send(`Hello ${req.params.name});
}

module.exports = {
  helloWorld: auth({ authBucket: 'gcs-bucket-proxying-auth' }, helloWorld);
}
```
[View Auth docs](src/auth/README.md)


## Composition

These functions are auto-curried handler-last functions, so they can be composed in a functional style.

```
function helloWorld (req, res) {
  return res.send(`Hello ${req.params.name});
}

const handle = compose(
  auth({ authBucket: 'my-auth-bucket' }),
  cors({ allowOrigin: '*' }),
  router('GET', '/:name'),
)

module.exports = {
  helloWorld: handle(helloWorld),
}
```

---
_Source: https://npm.io/package/gcframe-env · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
