Skip to content

Commit e02ef61

Browse files
authored
Merge pull request #557 from talkjs/fix/add-env-file-nextjs
Add example env file to Next.js tutorial
2 parents 013e3a7 + 65af29c commit e02ef61

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

react/next.js/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_APP_ID="<APP_ID>"

react/next.js/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ To run this tutorial, you will need:
1515
## How to run the tutorial
1616

1717
1. Clone or download the project.
18-
2. Replace `<APP_ID>` in `app/page.js` with the value found in the **Settings** tab of your [TalkJS dashboard](https://talkjs.com/dashboard/login).
19-
3. Run `npm install` to install dependencies.
20-
4. Run `npm run dev` to start the server.
21-
5. Visit <http://localhost:3000>.
18+
2. Copy `.env.example` to a new `.env` file.
19+
3. Replace `<APP_ID>` in `.env` with the value found in the **Settings** tab of your [TalkJS dashboard](https://talkjs.com/dashboard/login).
20+
4. Run `npm install` to install dependencies.
21+
5. Run `npm run dev` to start the server.
22+
6. Visit <http://localhost:3000>.
2223

2324
You should see a page which loads a chatbox on startup.

react/next.js/app/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function Chat() {
3838
}, []);
3939

4040
return (
41-
<Session appId="<APP_ID>" syncUser={syncUser}>
41+
<Session appId={process.env.NEXT_PUBLIC_APP_ID} syncUser={syncUser}>
4242
<Chatbox
4343
syncConversation={syncConversation}
4444
style={{ width: "100%", height: "500px" }}

0 commit comments

Comments
 (0)