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": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": [
|
||||||
"allowJs": true,
|
"dom",
|
||||||
"skipLibCheck": true,
|
"dom.iterable",
|
||||||
"strict": true,
|
"esnext"
|
||||||
"forceConsistentCasingInFileNames": true,
|
],
|
||||||
"noEmit": true,
|
"allowJs": true,
|
||||||
"esModuleInterop": true,
|
"skipLibCheck": true,
|
||||||
"module": "esnext",
|
"strict": true,
|
||||||
"moduleResolution": "node",
|
"forceConsistentCasingInFileNames": true,
|
||||||
"resolveJsonModule": true,
|
"noEmit": true,
|
||||||
"isolatedModules": true,
|
"esModuleInterop": true,
|
||||||
"jsx": "preserve",
|
"module": "esnext",
|
||||||
"incremental": true,
|
"moduleResolution": "node",
|
||||||
"paths": {
|
"resolveJsonModule": true,
|
||||||
"@/*": ["./*"]
|
"isolatedModules": true,
|
||||||
}
|
"jsx": "preserve",
|
||||||
},
|
"incremental": true,
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
"paths": {
|
||||||
"exclude": ["node_modules"]
|
"@/*": [
|
||||||
|
"./*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "next"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
".next/types/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue