nimbella / demo-projects Goto Github PK
View Code? Open in Web Editor NEWCollection of serverless projects that demonstrate stateful serverless applications including Jamstack applications.
License: Apache License 2.0
Collection of serverless projects that demonstrate stateful serverless applications including Jamstack applications.
License: Apache License 2.0
In credential.js
in the ocr example the options for generating a file upload for put are:
const options = {
headers: {
'Content-Type': 'multipart/formdata; charset=UTF-8', // wrong!
'Access-Control-Allow-Origin': '*',
'Cross-Domain': true
}
};
Actually when you do a PUT you DO NOT HAVE to use multipart form/data, just upload the file as is.
As a result, you have to do ad upload generating a put request that will upload the file as a binary string also specifying Contet-Type "multipart/formdata".... that is not.
I went crazy following the example because I tried to upload with put and multiplart/form-data that is NOT decoded by the put.
I was finally able to perform the upload removing the Content-Type when generating the file upload and then doing a plain put of the file to upload.
The News API needs unit tests, mocking the response from the google-news-rss
and sorting the results accordingly.
The api token for the stock API is currently set as a parameter but is better suited for an environment variable.
Several of the API functions read files into memory but do so inside main()
. Instead move these to init time and remove the conditional check.
For example, exitpolls
demo-projects/election/packages/ge2020/exitpolls/index.js
Lines 3 to 10 in b3fe3ae
becomes:
const contents = fs.readFileSync(__dirname + '/exitpolls.json', 'UTF-8');
const body = JSON.parse(contents)
function main(args) {
return { body }
}
There are several functions like this:
We've had a few asks for a typescript project. So we should add one.
This will be a useful project to demonstrate how to integrated with an external identity provider.
> nim project deploy github:nimbella/demo-projects/visits
Deploying project 'github:nimbella/demo-projects/visits'
to namespace '...'
on host '...'
Deployed 2 web content items to
...
Deployed actions ('nim action get <actionName> --url' for URL):
- visits/counter
- visits/info
Failures:
โบ Error: While deploying action visits/composer: Action 'visits/composer' not deployed: runtime type could not be determined
likely because we support php 8 now and this project has no project.yml
using require('nim')
gives deprecation message, replace it with the sdk
'nim' is deprecated. Please use '@nimbella/sdk' instead. Visit https://github.com/nimbella/nimbella-sdk-nodejs to learn more.
Currently qr-java is a package within the qrcode
project.
This is not a good illustration of multi-language development because both versions do basically the same thing.
It complicates use of the project under either ecosystem because deploying the project now requires the union of the tools of the two ecosystems. For example, you can't deploy the project as a nodejs developer without having mvn
installed (a more Java-centric tool). If this were motivated by a real multi-language use case it would be fine.
I suggest there should be two (top-level) projects qrcode-js
and qrcode-java
(or something like that).
If this is not done, then, at a minimum, because of this complication, the actual pre-requisites should be documented more clearly as such in the README since typical programmers might not have the union of both.
There are several APIs implemented as serverless functions located in the election/packages
directory:
https://github.com/nimbella/demo-projects/tree/master/election/packages/ge2020
Some of these functions make API calls to the Google civic API. Add unit tests for each API/function by mocking the API call and simulating the API response.
We temporarily removed the voterinfo page. We should add this back.
Rodric suggested one based on https://towardsdatascience.com/creating-a-restful-serverless-api-with-azure-functions-and-mongodb-6221cfd51a43. Rodric says
it looks like most if not all of the code is there
client would need mongolabs account and to provide credentials with env vars
I'll get myself a mongolabs account and see if I agree that "all of the code is there" ๐ .
For the election
project, we should rename the API secret from g_token
to GOOGLE_CIVIC_API_TOKEN
and use $(GOOGLE_CIVIC_API_TOKEN)
in the project.yml
because it makes the deploy step/instruction simpler (no .env file to create).
A .env file may still be used. The docs should describe how to use both.
The election demo has a lot of open dependencies. It recently entered a state where the actual dependencies that are loaded are inconsistent:
> [email protected] build .../main/config/deployable/election/web
> react-scripts build
Creating an optimized production build...
Failed to compile.
./node_modules/mobx-react-lite/es/utils/assertEnvironment.js
Attempted import error: 'makeObservable' is not exported from 'mobx'.
This breaks the Jenkins deploy job. I am separately recommending that we take the election demo out of the main build until this is fixed.
When entering a query in the division and voter info page, the search isn't executed until you click the magnifying glass. It should at least accept the return
key being pressed or make it more clear you need to click the icon.
The election project requires an api key for the civic API. The app should use the Nimbella API if a key is not provided so that it's easier to deploy and get started.
The documentation should be updated accordingly.
The OCR example which adds slack notifications should use an environment
property in the project manifest instead of parameters.
demo-projects/ocr/project-slack-notification.yml
Lines 12 to 14 in bd922f8
This is also needed for the Printer demo.
demo-projects/printer/project.yml
Lines 10 to 12 in bd922f8
we have several react apps but they requires api keys (trade demo), or are long builds (chat) - I suggest adding a smaller react example that is easier to understand.
I suggest setting up GitHub actions to build the demos.
Originally posted by @rabbah in #47 (comment)
The docs right now assume the project will provide its own API key. Instead, allow for a configuration for the app so that in the absence of a key, the Nimbella API is used instead.
Allow page visitor to click on sate to assign the electoral votes to one of the two parties and tally up the results. This permits the user to simulate a path to victory.
We welcome enhancements to existing command sets and entirely new command sets. We need to put a contribution guide and how to facilitate such contributions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.