Skip to content

Commit

Permalink
Merge pull request #6 from tiagoluizpoli/develop
Browse files Browse the repository at this point in the history
added vercel token as github secret
  • Loading branch information
tiagoluizpoli authored Oct 11, 2023
2 parents a52a3b4 + db73357 commit be206ef
Show file tree
Hide file tree
Showing 18 changed files with 724 additions and 5,281 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
- name: "Install Dependencies"
run: "npm install"
- name: "Publish to Vercel"
run: "npx vercel --prod --token=c2JS23XHGpIQLMekiTNbAy08"
run: "npx vercel --prod --token=${{ secrets.VERCEL_TOKEN }}"
8 changes: 8 additions & 0 deletions app/api/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const GET = async () => {
return new Response(
JSON.stringify({ route: '/api', message: 'Hello World' }),
{
status: 200,
},
);
};
8 changes: 8 additions & 0 deletions app/api/todos/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { todoController } from '@/server/controller';
export const GET = async (request: Request) => {
return await todoController.get(request);
};

export const POST = async (request: Request) => {
return await todoController.create(request);
};
20 changes: 20 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import StyledJsxRegistry from './registry';
export const metadata = {
title: 'Next.js',
description: 'Generated by Next.js',
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang='en'>
<body>
<StyledJsxRegistry>{children}</StyledJsxRegistry>
</body>
</html>
);
}
2 changes: 2 additions & 0 deletions pages/index.tsx → app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React, { useEffect, useRef, useState } from 'react';
import { GlobalStyles } from '@/ui/theme/GlobalStyles';
import { todoController } from '@/ui/controller/todo';
Expand Down
23 changes: 23 additions & 0 deletions app/registry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use client';

import React, { useState } from 'react';
import { useServerInsertedHTML } from 'next/navigation';
import { StyleRegistry, createStyleRegistry } from 'styled-jsx';

export default function StyledJsxRegistry({
children,
}: {
children: React.ReactNode;
}) {
// Only create stylesheet once with lazy initial state
// x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
const [jsxStyleRegistry] = useState(() => createStyleRegistry());

useServerInsertedHTML(() => {
const styles = jsxStyleRegistry.styles();
jsxStyleRegistry.flush();
return <>{styles}</>;
});

return <StyleRegistry registry={jsxStyleRegistry}>{children}</StyleRegistry>;
}
17 changes: 17 additions & 0 deletions lib/prisma.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { PrismaClient } from '@prisma/client';

const prismaClientSingleton = () => {
return new PrismaClient();
};

type PrismaClientSingleton = ReturnType<typeof prismaClientSingleton>;

const globalForPrisma = globalThis as unknown as {
prisma: PrismaClientSingleton | undefined;
};

const prisma = globalForPrisma.prisma ?? prismaClientSingleton();

export default prisma;

if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
1 change: 1 addition & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
reactStrictMode: true,
reactStrictMode: true,
};
Loading

0 comments on commit be206ef

Please sign in to comment.