Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasconstantino/now-micro
The missing Micro builder for Now 2.0
https://github.com/lucasconstantino/now-micro
builder micro now
Last synced: 3 months ago
JSON representation
The missing Micro builder for Now 2.0
- Host: GitHub
- URL: https://github.com/lucasconstantino/now-micro
- Owner: lucasconstantino
- License: mit
- Created: 2019-01-03T05:52:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-20T15:51:43.000Z (over 5 years ago)
- Last Synced: 2024-10-30T18:04:26.385Z (3 months ago)
- Topics: builder, micro, now
- Language: JavaScript
- Size: 398 KB
- Stars: 45
- Watchers: 6
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Now Micro
[![Build Status](https://travis-ci.org/lucasconstantino/now-micro.svg?branch=master)](https://travis-ci.org/lucasconstantino/now-micro)
[![coverage](https://img.shields.io/codecov/c/github/lucasconstantino/now-micro.svg?style=flat-square)](https://codecov.io/github/lucasconstantino/now-micro)
[![npm version](https://img.shields.io/npm/v/now-micro.svg?style=flat-square)](https://www.npmjs.com/package/now-micro)Proper Micro builder for [Now 2.0](https://zeit.co/blog/now-2)
## Purpose
As of now, `@now/node` lambdas resemble a lot a [Micro](https://github.com/zeit/micro) environment, but it is just not that, which causes quite a lot of [unexpected](https://hyperion.alpha.spectrum.chat/zeit/now/504-lambda-invocation-timeout~dd711cf6-347d-4a91-83b3-c2ae097c4ce1) [results](https://github.com/zeit/now-builders/issues/133).
## Installation
`yarn add now-micro micro`
> Gotcha: so far we found no way to inject `micro` dependency during the build process, so it MUST be a dependency of your lambda, thus why we added it to the above command ;)
## Usage
Use `now-micro` in your builders on `now.json`:
```json
{
"version": 2,
"builds": [{ "src": "file.js", "use": "now-micro" }]
}
```Develop your lambdas as a fully Micro compatible function:
```js
// ex. showing async usage and value returning (no res.end):
module.exports = async req => Promise.resolve(`Some result`)
```