You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For more information about RootLayout see the [NextJS documentation](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required).
For more information about RootLayout see the [NextJS documentation](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required).
73
71
5. You're now ready to use Stringtale in your project. For more information on how to use Stringtale with React see our [React documentation](/front-end/react).
For more information about `RootLayout` see the [NextJS documentation](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required).
96
-
</TabItem>
97
-
<TabItemlabel="Next.js (pages router)">
98
-
1. Attempt to locate your `next.config.js` to detect the root of your project or prompt you if it can't find the correct one.
99
-
2. Create `<PROJECT_DIRECTORY>/pages/api/stringtale.ts` to enable `/api/stringtale`.
100
-
3. Add the required dependencies for your project.
101
-
5. It will instruct you to customize your App component in `_app.tsx` and add the `<StringtaleProvider>`
For more information about customizing the `App` component see the [NextJS documentation](https://nextjs.org/docs/pages/building-your-application/routing/custom-app).
115
-
</TabItem>
116
-
<TabItemlabel="Express.js">
117
-
1. Add the required dependencies for your project.
118
-
2. Instruct you to add the `/api/stringtale` route. Because of how Express handles routing, we don't add this automatically. Example:
119
-
```tsx
120
-
importexpressfrom'express'
121
-
import { setupRoute } from"@stringtale/express"
122
-
const app =express()
123
-
124
-
app.all('/api/stringtale', setupRoute({
125
-
apiKey: process.env.STRINGTALE_API_KEY!
126
-
}))
127
-
```
128
-
3. Instruct you to add the `<StringtaleProvider>` with `apiRoute` attribute to App component in `app.js` / `app.tsx`. Example:
For more information about `RootLayout` see the [NextJS documentation](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required).
90
+
91
+
</TabItem>
92
+
<TabItemlabel="Next.js (pages router)">
93
+
1. Attempt to locate your `next.config.js` to detect the root of your project or prompt you if it can't find the correct one.
94
+
2. Create `<PROJECT_DIRECTORY>/pages/api/stringtale.ts` to enable `/api/stringtale`.
95
+
3. Add the required dependencies for your project.
96
+
5. It will instruct you to customize your App component in `_app.tsx` and add the `<StringtaleProvider>`
For more information about customizing the `App` component see the [NextJS documentation](https://nextjs.org/docs/pages/building-your-application/routing/custom-app).
110
+
111
+
</TabItem>
112
+
<TabItemlabel="Express.js">
113
+
1. Add the required dependencies for your project.
114
+
2. Instruct you to add the `/api/stringtale` route. Because of how Express handles routing, we don't add this automatically. Example:
115
+
```tsx
116
+
importexpressfrom'express'
117
+
import { setupRoute } from"@stringtale/express"
118
+
const app =express()
119
+
120
+
app.all('/api/stringtale', setupRoute({
121
+
apiKey: process.env.STRINGTALE_API_KEY!
122
+
}))
123
+
```
124
+
3. Instruct you to add the `<StringtaleProvider>` with `apiRoute` attribute to App component in `app.js` / `app.tsx`. Example:
4. Once `stringtale init` has finished, it's integrated with your back-end. To start using Stringtale in your front-end,
147
144
check out the next section.
148
-
145
+
149
146
### Integrating Stringtale on your front-end
150
147
151
148
In order to integrate Stringtale in your React front-end you can either start wrapping your strings manually,
@@ -164,22 +161,24 @@ To start using Stringtale on a subset of your strings, please refer to the docum
164
161
165
162
Deploying Stringtale to your test environment is very straight forward. Just deploy your application as usual, add `STRINGTALE_API_KEY` to your
166
163
environment variables and you're good to go. To obtain the `STRINGTALE_API_KEY` you can follow the steps below:
164
+
167
165
1. Go to the [Stringtale Dashboard](https://stringtale.com/app).
168
166
2. Go to [Projects](https://stringtale.com/app/projects)
169
167
3. Open the project (or click on Edit project settings) you want to deploy to your test / preview environment.
170
168
4. Scroll down to `Tokens`
171
169
5. Click on `Add Token` and create a new token
172
-
<Imagesrc={step24}alt="Tokens section of Stringtale project" />
170
+
<Imagesrc={step24}alt="Tokens section of Stringtale project" />
173
171
6. Save the token somewhere safe, you'll need it later.
174
-
<Imagesrc={step25}alt="Example of a token"width="564px" />
172
+
<Imagesrc={step25}alt="Example of a token"width="564px" />
175
173
7. Enable 'Write' permissions for the newly created token by checking the checkbox for 'Can write'.
176
174
177
175
Now you can deploy your application and add `STRINGTALE_API_KEY` to your environment variables. You can start using Stringtale by adding `?stringtale` to the URL or by using our [browser extension](/usage/browser-extension).
178
176
179
177
For more information on how to use Stringtale once you've deployed it, checkout the [workflow](/guides/workflow) documentation.
180
178
181
179
<Asidetype="caution">
182
-
It's highly recommended you lock down your test / preview environment through some form authentication (i.e. basic auth),
183
-
as there's no user authentication for text edits in Stringtale at this moment. This means that without authentication,
184
-
anyone would be able to edit text on your website.
180
+
It's highly recommended you lock down your test / preview environment through
181
+
some form authentication (i.e. basic auth), as there's no user authentication
182
+
for text edits in Stringtale at this moment. This means that without
183
+
authentication, anyone would be able to edit text on your website.
0 commit comments