Skip to content

Commit

Permalink
docs: replace libc6-compat by gcompat in Dockerfile (#433)
Browse files Browse the repository at this point in the history
* docs: replace libc6-compat by gcompat in Dockerfile

* fix: prettier format

---------

Co-authored-by: Antony DAVID <antony.david@urbanandmainlines.com>
  • Loading branch information
Jayllyz and Antony DAVID authored Jul 10, 2024
1 parent 8fc3754 commit 7833310
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 25 deletions.
4 changes: 2 additions & 2 deletions docs/getting-started/cloudflare-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,17 @@ bun run deploy
:::

### Deploy via the Cloudflare dashboard with GitHub

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. In Account Home, select Workers & Pages > Create application > Pages > Connect to Git.
3. Authorize your GitHub account, and select the repository. In Set up builds and deployments, provide the following information:

| Configuration option | Value |
|----------------------|-----------------|
| -------------------- | --------------- |
| Production branch | `main` |
| Build command | `npm run build` |
| Build directory | `dist` |


## Bindings

You can use Cloudflare Bindings like Variables, KV, D1, and others.
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ FROM node:20-alpine AS base

FROM base AS builder

RUN apk add --no-cache libc6-compat
RUN apk add --no-cache gcompat
WORKDIR /app

COPY package*json tsconfig.json src ./
Expand Down
2 changes: 1 addition & 1 deletion docs/middleware/builtin/jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The JWT Auth Middleware provides authentication by verifying the token with JWT.
The middleware will check for an `Authorization` header if the `cookie` option is not set.

:::info
The Authorization header sent from the client must have a specified scheme.
The Authorization header sent from the client must have a specified scheme.

Example: `Bearer my.token.value` or `Basic my.token.value`
:::
Expand Down
48 changes: 27 additions & 21 deletions examples/prisma.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,23 @@ DATABASE_URL="prisma://accelerate...."

Copy this `DATABASE_URL` and store it in `.dev.vars` and `.env` so that prisma cli can access it later on.


## Set Up Prisma in Your Project

The neon.tech URL you received can also be used as an alternative and provide Prisma with more options, so store it for later use:

::: code-group

::: code-group
```ts [.dev.vars]
DATABASE_URL="your_prisma_accelerate_url"
DIRECT_URL="your_neon_tech_url"
```
:::
```bash [.dev.vars]
DATABASE_URL="your_prisma_accelerate_url"
DIRECT_URL="your_neon_tech_url
```
:::
Now, go to your `schema.prisma` file and set the URLs like this:
::: code-group
```ts [schema.prisma]
generator client {
provider = "prisma-client-js"
Expand All @@ -74,46 +75,51 @@ datasource db {
directUrl = env("DIRECT_URL")
}
```
:::
Create a function like this, which you can use in your project later:
::: code-group
```ts [prismaFunction.ts]
import { PrismaClient } from '@prisma/client/edge'
import { withAccelerate } from '@prisma/extension-accelerate'
export const getPrisma = (database_url: string) => {
const prisma = new PrismaClient({
datasourceUrl: database_url,
}).$extends(withAccelerate());
return prisma
const prisma = new PrismaClient({
datasourceUrl: database_url,
}).$extends(withAccelerate())
return prisma
}
```
:::
Here is an example of how you can use this function in your project:
::: code-group
```ts [index.ts]
import { Hono } from 'hono';
import { sign, verify } from 'hono/jwt';
import { getPrisma } from '../usefulFun/prismaFun';
import { Hono } from 'hono'
import { sign, verify } from 'hono/jwt'
import { getPrisma } from '../usefulFun/prismaFun'
// Create the main Hono app
const app = new Hono<{
Bindings: {
DATABASE_URL: string
JWT_SECRET: string
},
}
Variables: {
userId: string,
userId: string
}
}>();
}>()
app.post('/', async (c) => {
// Now you can use it wherever you want
const prisma = getPrisma(c.env.DATABASE_URL);
});
// Now you can use it wherever you want
const prisma = getPrisma(c.env.DATABASE_URL)
})
```
:::
:::

0 comments on commit 7833310

Please sign in to comment.