init: run and move to app router
parent
f8ab614290
commit
01fee29a39
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,21 @@
|
||||
import { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Rapid App with NextJS App-Router",
|
||||
description:
|
||||
"Rapid App with NextJS App Router (React TypeScript + Rust Api Routes)",
|
||||
};
|
||||
|
||||
export default function Layout({
|
||||
// Layouts must accept a children prop.
|
||||
// This will be populated with nested layouts or pages
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
import { Welcome, createBoltClient } from "@rapid-web/react";
|
||||
import { routes, Handlers } from "../pages/api/bindings";
|
||||
|
||||
const bolt = createBoltClient<Handlers, typeof routes>(routes, {
|
||||
transport: "http://localhost:8080",
|
||||
});
|
||||
|
||||
export default async function Home() {
|
||||
const { data: title } = await bolt("hello").get(routes.hello);
|
||||
|
||||
return (
|
||||
<main>
|
||||
<Welcome>
|
||||
<p className="mt-4">{title}</p>
|
||||
</Welcome>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
import { Welcome, createBoltClient } from '@rapid-web/react';
|
||||
import { routes, Handlers } from './api/bindings';
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
}
|
||||
|
||||
export const bolt = createBoltClient<Handlers, typeof routes>(routes, {
|
||||
transport: 'http://localhost:8080',
|
||||
});
|
||||
|
||||
export default function Home({ title }: Props) {
|
||||
return (
|
||||
<main>
|
||||
<Welcome>
|
||||
<p className='mt-4'>{title}</p>
|
||||
</Welcome>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
const req = await bolt('hello').get(routes.hello);
|
||||
|
||||
return {
|
||||
props: {
|
||||
title: req.data,
|
||||
},
|
||||
};
|
||||
}
|
@ -1,23 +1,41 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./*"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue