Skip to content

Instantly share code, notes, and snippets.

View mxro's full-sized avatar

Max Rohde mxro

View GitHub Profile
[
{
"names": [
"goldstack-ci-test-server-side-rendering-1665262198346--__index.map"
],
"generatedName": "-__index.63d7f8a9e4e613831f8e7ee052143f64.map.json"
},
{
"names": [
"goldstack-ci-test-server-side-rendering-1665262198346--__index-bundle.js"
return {
plugins: [
ignorePlugin({ ignore: ['ui'] }),
cssPlugin({
excludeCSSInject: !args.includeCss,
cssConfig: {
plugins: [],
},
}),
pnpPlugin(),
return {
plugins: [
ignorePlugin({ ignore: ['server'] }),
cssPlugin({
excludeCSSInject: true,
onCSSGenerated: args.onCSSGenerated,
}),
pnpPlugin(),
],
bundle: true,
@mxro
mxro / goldstack.json
Created October 20, 2022 19:56
goldstack.json
{
"lambdas": {
"ANY /": {
"function_name": "goldstack-ci-test-server-side-rendering-1665262198346--__index",
"route": "ANY /"
},
"ANY /posts": {
"function_name": "goldstack-ci-test-server-side-rendering-1665262198346-posts",
"route": "ANY /posts"
}
@mxro
mxro / lambda.tf
Created October 20, 2022 19:56
lambda.tf
resource "aws_lambda_function" "this" {
for_each = var.lambdas
function_name = lookup(each.value, "function_name", null)
filename = data.archive_file.empty_lambda.output_path
handler = "lambda.handler"
runtime = "nodejs16.x"
import * as render from './../server/render';
export const handler: SSRHandler = async (event, context) => {
return render.performRender(event);
}
@mxro
mxro / render.ts
Created October 20, 2022 19:54
render.ts
/* esbuild-ignore ui */
import { renderPage } from './../render';
import fs from 'fs';
export async function performRender({
event,
}: {
event: APIGatewayProxyEventV2;
}): Promise<APIGatewayProxyResultV2> {
@mxro
mxro / react1.tsx
Last active October 20, 2022 19:53
react1.tsx
import React from 'react';
import { SSRHandler } from '@goldstack/template-ssr';
import { renderPage, hydrate } from './../render';
const Posts = (props: { posts: string[] }): JSX.Element => {
return (
<>
<p>Posts:</p>
{props.posts.map((p, idx) => (
return <div className={styles.myclass}></div>;
import React from 'react';
import styles from './MyComponent.module.css';