Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/james9074/lambda
It's like JSFiddle, but any language and you can execute your code via the API. Enterprise friendly. GraphQL. https://lambda.wlan1.net
https://github.com/james9074/lambda
docker graphql js lambda react
Last synced: 15 days ago
JSON representation
It's like JSFiddle, but any language and you can execute your code via the API. Enterprise friendly. GraphQL. https://lambda.wlan1.net
- Host: GitHub
- URL: https://github.com/james9074/lambda
- Owner: James9074
- Created: 2017-08-12T19:49:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T00:53:00.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T10:53:58.102Z (7 months ago)
- Topics: docker, graphql, js, lambda, react
- Language: JavaScript
- Homepage:
- Size: 1.3 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 56
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Lambda Banner](lambda.png)
# Lambda [![build status](https://gitlab.com/James9074/lambda/badges/master/build.svg)](https://gitlab.com/James9074/lambda/commits/master) ![graphql](https://img.shields.io/badge/style-%E2%9C%93-blue.svg?style=flat&label=GraphQL) ![react](https://img.shields.io/badge/style-%E2%9C%93-blue.svg?style=flat&label=React) ![Docker](https://img.shields.io/badge/style-%E2%9C%93-blue.svg?style=flat&label=Docker&)
A code playground and micro api creation platform allowing developers to put scripts "on tap" without the need to stand up dedicated resources. This is what we get when we combine AWS Lambda and JSFiddle.Created with love from [Kirasoft's Nodejs API Starter](https://github.com/kriasoft/nodejs-api-starter) repo.
## File Guidelines
`docker-compose.yml` - The production-ready docker-compose file.
`docker-compose.override.yml` - The development-ready docker-compose file, with app-code volume mounts and port exposures configuredThe Dockerfiles are configured with the correct CMD entries for prod, so there's no `command` entry in the docker-compose.yml file, but the `docker-compose.override.yml` file does have a development friendly command that laucnhes the app in watch-mode.
## Getting Started (Dev)
```bash
git clone
docker-compose up -d # this will automatically run DB migrations
cd api && yarn docker-db-seed
# Optionally, if you want to rollback migrations and restore the database to a clean, unseeded state:
docker-db-reset
```### Fun yarn shortcuts
**`cd api && ...`**
- `yarn docker-db-migrate` - runs the migrations. Useful on first start or after writing a migration file
`- yarn docker-db-seed` - Seeds the DB with [Faker](https://www.npmjs.com/package/Faker) data
- `yarn docker-db-reset` - Rolls back all migrations and runs `docker-db-migrate` for you. Effectively gives a clean slate.
- `yarn docker-db-rollback`- Rolls back the DB, but doesn't restore it.## Getting Started (Prod)
```bash
git clone
./build-prod # Just a shortcut for building with the prod docker-compose file. This is critical, since the override file (dev) will build with volume mounts, which is bad.
docker-compose -f docker-compose.yml up -d # Starts the services in prod mode without the dev volumes
```### Prod Notes
The `docker-compose.yml` build only incudes the build output, meaning `/src`, `/test`, `/db`, and a few other things are not in the image.### Quick GraphQL Query Examples
```graphql
mutation DeleteLambda($input: DeleteLambdaInput!) {
deleteLambda(input: $input) {
result
}
}mutation UpdateLambda($updateInput: UpdateLambdaInput!) {
updateLambda(input: $updateInput) {
lambda{
id,
name,
slug,
code,
updatedAt
}
}
}query GetCurrentUser {
me {
id
displayName
lambdas {
name,
slug,
}
}
}query GetSingleUser {
node(id: "VXNlcjplMmQ5N2RiNi03YTE1LTExZTctYmQ1Zi0zMzk3NDBmMzQ5NGM=") {
id
... on User {
displayName
username
emails{
}
lambdas {
name
slug
}
}
}
}query GetSingleUserById {
user(id:"3339ee26-7a4d-11e7-9b78-87460c3a2f4b") {
id
displayName
lambdas {
name,
slug,
}
}
}query GetSingleUserByUsername {
user(username:"Hillard.Streich46") {
id
displayName
lambdas {
name,
slug,
}
}
}query GetAllUsers {
users(first: 10) {
edges {
node {
id
displayName
lambdas {
name
slug
}
}
}
}
}query GetAllLambdas {
lambdas(first: 10) {
edges {
node {
name
slug
owner_id,
owner{
displayName,
username,
emails{
}
}
}
}
}
}query GetSingleLambdaBySlug {
lambda(slug:"H1SxurWuW") {
name,
id,
slug,
owner{
username
id
}
}
}query GetAllLambdasByUsername {
lambdas(username:"Hillard.Streich46") {
edges {
node {
name
slug
owner_id,
owner{
displayName,
username,
emails{
}
}
}
}
}
}mutation CreateLambda($createInput: CreateLambdaInput!){
createLambda(input: $createInput) {
lambda{
id
}
}
}```
...and the inputs:
```JSON
{
"input": {
"slug": "H1SxurWuW"
},
"createInput": {
"slug": "H1SxurWuW",
"name": "test",
"description": " test",
"inputs": "[]",
"code": "teasdasdst",
"owner_id": "fc956662-822a-11e7-9da0-e7a666d18b85",
"public": 1
},
"updateInput": {
"slug": "H1SxurWuW",
"name": "updated",
"description": " test2",
"inputs": "[]",
"code": "teasdasdst",
"owner_id": "fc956662-822a-11e7-9da0-e7a666d18b85",
"public": 1
}
}
```