generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 21
Add React SSR demo with Micronaut and GraalJS #42
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
Open
elhoussnifatimazahra
wants to merge
11
commits into
graalvm:main
Choose a base branch
from
elhoussnifatimazahra:fatimazahra/graaljs-react-ssr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
781eb99
Add React SSR demo with Micronaut and GraalJS
elhoussnifatimazahra 81413f3
Incorporate feedback from PR review
elhoussnifatimazahra 80ca37d
Update graaljs-react-ssr.yml
elhoussnifatimazahra 6985ce8
Rename demo folder
fniephaus 2b40f8d
Format files and clean up.
fniephaus d51b1d0
Revise demo and add more examples.
fniephaus 6a5e63a
Revise `README.md`.
fniephaus b33f6a6
Improve testing.
fniephaus eb0e8f3
Fixes.
fniephaus 1c01e64
Fix test execution.
fniephaus 42555c7
Add tooltips and `client.js` again.
fniephaus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Test GraalJS React SSR with Micronaut | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - 'graaljs/graaljs-micronaut-react-ssr/**' | ||
| - '.github/workflows/graaljs-micronaut-react-ssr.yml' | ||
| pull_request: | ||
| paths: | ||
| - 'graaljs/graaljs-micronaut-react-ssr/**' | ||
| - '.github/workflows/graaljs-micronaut-react-ssr.yml' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| run: | ||
| name: 'graaljs-micronaut-react-ssr' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: graalvm/setup-graalvm@v1 | ||
| with: | ||
| java-version: '24.0.2' | ||
| distribution: 'graalvm' | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| cache: 'maven' | ||
|
|
||
| - name: Build, test, and run Micronaut app | ||
| run: | | ||
| cd graaljs/graaljs-micronaut-react-ssr | ||
| ./mvnw --no-transfer-progress clean package | ||
| ./mvnw --no-transfer-progress mn:run & | ||
| mnpid="$!" | ||
| sleep 30 | ||
| curl --fail-with-body --silent --dump-header - -o /dev/null http://localhost:8080 | ||
| kill $mnpid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Thumbs.db | ||
| .DS_Store | ||
| .gradle | ||
| build/ | ||
| target/ | ||
| out/ | ||
| .micronaut/ | ||
| .idea | ||
| *.iml | ||
| *.ipr | ||
| *.iws | ||
| .project | ||
| .settings | ||
| .classpath | ||
| .factorypath | ||
| src/js/node_modules |
18 changes: 18 additions & 0 deletions
18
graaljs/graaljs-micronaut-react-ssr/.mvn/wrapper/maven-wrapper.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip | ||
| wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||
| # React SSR with Micronaut | ||||||
|
|
||||||
| This project demonstrates how to render [various Recharts examples](https://recharts.org/en-US/examples) in a [Micronaut](https://micronaut.io/) application. | ||||||
| For this, it uses the [React view feature](https://micronaut-projects.github.io/micronaut-views/latest/guide/#react) in Micronaut that enables Server-Side Rendering (SSR) of React components using [GraalJS](https://www.graalvm.org/javascript/). | ||||||
|
|
||||||
| ## Prerequisites | ||||||
|
|
||||||
| Before you begin, make sure you have the following: | ||||||
|
|
||||||
| * A bit of time to explore and experiment | ||||||
| * Your favorite text editor or IDE | ||||||
| * JDK 21 or later | ||||||
|
|
||||||
| ## Run the Application | ||||||
|
|
||||||
| 1. Clone the repository: | ||||||
|
|
||||||
| ```bash | ||||||
| git clone https://github.com/graalvm/graal-languages-demos.git | ||||||
| cd graaljs/graaljs-micronaut-react-ssr | ||||||
| ``` | ||||||
|
|
||||||
| 2. Build and run the Micronaut application: | ||||||
|
|
||||||
| ```bash | ||||||
| ./mvnw mn:run | ||||||
| ``` | ||||||
|
|
||||||
| 3. Open your browser and go to [http://localhost:8080](http://localhost:8080) to view the Recharts examples. | ||||||
| Since the charts are rendered on the server, they work even with JavaScript disabled in the browser. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # AOT configuration properties for jar packaging | ||
| # Please review carefully the optimizations enabled below | ||
| # Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details | ||
|
|
||
| # Caches environment property values: environment properties will be deemed immutable after application startup. | ||
| cached.environment.enabled=true | ||
|
|
||
| # Precomputes Micronaut configuration property keys from the current environment variables | ||
| precompute.environment.properties.enabled=true | ||
|
|
||
| # Replaces logback.xml with a pure Java configuration | ||
| logback.xml.to.java.enabled=true | ||
|
|
||
| # Converts YAML configuration files to Java configuration | ||
| yaml.to.java.config.enabled=true | ||
|
|
||
| # Scans for service types ahead-of-time, avoiding classpath scanning at startup | ||
| serviceloading.jit.enabled=true | ||
|
|
||
| # Scans reactive types at build time instead of runtime | ||
| scan.reactive.types.enabled=true | ||
|
|
||
| # Deduces the environment at build time instead of runtime | ||
| deduce.environment.enabled=true | ||
|
|
||
| # Checks for the existence of some types at build time instead of runtime | ||
| known.missing.types.enabled=true | ||
|
|
||
| # Precomputes property sources at build time | ||
| sealed.property.source.enabled=true | ||
|
|
||
| # The list of service types to be scanned (comma separated) | ||
| service.types=io.micronaut.context.env.PropertySourceLoader,io.micronaut.inject.BeanConfiguration,io.micronaut.inject.BeanDefinitionReference,io.micronaut.http.HttpRequestFactory,io.micronaut.http.HttpResponseFactory,io.micronaut.core.beans.BeanIntrospectionReference,io.micronaut.core.convert.TypeConverterRegistrar,io.micronaut.context.env.PropertyExpressionResolver | ||
|
|
||
| # A list of types that the AOT analyzer needs to check for existence (comma separated) | ||
| known.missing.types.list=io.reactivex.Observable,reactor.core.publisher.Flux,kotlinx.coroutines.flow.Flow,io.reactivex.rxjava3.core.Flowable,io.reactivex.rxjava3.core.Observable,io.reactivex.Single,reactor.core.publisher.Mono,io.reactivex.Maybe,io.reactivex.rxjava3.core.Single,io.reactivex.rxjava3.core.Maybe,io.reactivex.Completable,io.reactivex.rxjava3.core.Completable,io.methvin.watchservice.MacOSXListeningWatchService,io.micronaut.core.async.publisher.CompletableFuturePublisher,io.micronaut.core.async.publisher.Publishers.JustPublisher,io.micronaut.core.async.subscriber.Completable | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| applicationType: default | ||
| defaultPackage: com.example | ||
| testFramework: junit | ||
| sourceLanguage: java | ||
| buildTool: maven | ||
| features: [app-name, http-client-test, java, java-application, junit, logback, maven, maven-enforcer-plugin, micronaut-aot, micronaut-http-validation, netty-server, properties, readme, serialization-jackson, shade, static-resources, views-react] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.