@@ -66,21 +66,17 @@ To run the app, you'll need:
6666- A [ Fauna account] ( https://dashboard.fauna.com/register ) . You can sign up for a
6767 free account at https://dashboard.fauna.com/register .
6868
69- - Your preferred flavor of Java 17
69+ - Your preferred flavor of Java 17.
7070
71- - [ Fauna CLI] ( https://docs.fauna.com/fauna/current/tools/shell/ ) v3.0.0 or later.
71+ - [ Fauna CLI v4 beta] ( https://docs.fauna.com/fauna/current/build/cli/v4/ ) or later.
72+ - [ Node.js] ( https://nodejs.org/en/download/ ) v20.x or later.
7273
7374 To install the CLI, run:
7475
7576 ``` sh
76- npm install -g fauna-shell@latest
77+ npm install -g fauna-shell@" >=4.0.0-beta "
7778 ```
7879
79- You should also be familiar with basic Fauna CLI commands and usage. For an
80- overview, see the [Fauna CLI
81- docs](https://docs.fauna.com/fauna/current/tools/shell/).
82-
83-
8480# # Setup
8581
86821. Clone the repo and navigate to the ` java-sample-app` directory:
@@ -90,87 +86,69 @@ docs](https://docs.fauna.com/fauna/current/tools/shell/).
9086 cd java-sample-app
9187 ` ` `
9288
93- 2. Log in to Fauna using the Fauna CLI:
89+ 2. If you haven ' t already, log in to Fauna using the Fauna CLI:
9490
9591 ```sh
96- fauna cloud- login
92+ fauna login
9793 ```
9894
99- When prompted, enter:
100-
101- * ** Endpoint name:** ` cloud` (Press Enter)
102- * ** Email address:** The email address for your Fauna account.
103- * ** Password:** The password for your Fauna account.
104- * ** Which endpoint would you like to set as default?** The ` cloud-* `
105- endpoint for your preferred region group. For example, to use the US
106- region group, use ` cloud-us` .
107-
108- The command requires an email and password login. If you log in to Fauna
109- using GitHub or Netlify, you can enable email and password login using the
110- [Forgot Password](https://dashboard.fauna.com/forgot-password) workflow.
111-
112- 3. Use the Fauna CLI to create the ` ECommerceJava` database:
95+ 3. Use the CLI to create the `ECommerceJava` database:
11396
11497 ```sh
115- fauna create-database ECommerceJava
98+ # Replace ' us' with your preferred Region Group:
99+ # ' us' (United States), ' eu' (Europe), or `global` (available to Pro accounts and above).
100+ fauna database create \
101+ --name ECommerceJava \
102+ --database us
116103 ```
117104
118- 4. Create a
119- [` .fauna-project` ](https://docs.fauna.com/fauna/current/tools/shell/# proj-config)
120- config file for the project:
121-
122- ` ` ` sh
123- fauna project init
124- ` ` `
125-
126- When prompted, enter:
127-
128- * ` schema` as the schema directory.
129- * ` dev` as the environment name.
130- * The default endpoint.
131- * ` ECommerce` as the database.
132-
133- 5. Push the ` .fsl` files in the ` schema` directory to the ` ECommerceJava`
105+ 4. Push the `.fsl` files in the `schema` directory to the `ECommerceJava`
134106 database:
135107
136108 ```sh
137- fauna schema push
109+ # Replace ' us' with your Region Group.
110+ fauna schema push \
111+ --database us/ECommerceJava
138112 ```
139113
140114 When prompted, accept and stage the schema.
141115
142- 6 . Check the status of the staged schema:
116+ 5 . Check the status of the staged schema:
143117
144118 ```sh
145- fauna schema status
119+ fauna schema status \
120+ --database us/ECommerceJava
146121 ```
147122
148- 7 . When the status is ` ready` , commit the staged schema to the database:
123+ 6 . When the status is `ready`, commit the staged schema to the database:
149124
150125 ```sh
151- fauna schema commit
126+ fauna schema commit \
127+ --database us/ECommerceJava
152128 ```
153129
154130 The commit applies the staged schema to the database. The commit creates the
155131 collections and user-defined functions (UDFs) defined in the `.fsl` files of the
156132 `schema` directory.
157133
158- 8 . Create a key with the ` server` role for the ` ECommerceJava` database:
134+ 7 . Create a key with the `server` role for the `ECommerceJava` database:
159135
160136 ```sh
161- fauna create-key --environment=' ' ECommerceJava server
137+ fauna query "Key.create({ role: ' server' })" \
138+ --database us/ECommerceJava
162139 ```
163140
164141 Copy the returned `secret`. The app can use the key' s secret to authenticate
165142 requests to the database.
166143
167144# # Add sample data
168145
169- The app includes a setup script that adds sample documents to the
146+ The app includes a seed script that adds sample documents to the
170147` ECommerceJava` database. From the root directory, run:
171148
172149` ` ` sh
173- FAUNA_SECRET=<secret> ./setup.sh
150+ chmod +x ./scripts/seed.sh
151+ FAUNA_SECRET=< secret> ./scripts/seed.sh
174152` ` `
175153
176154You can view documents created by the script in the [Fauna
@@ -232,7 +210,7 @@ Customer documents and related API responses:
2322101. If you haven' t already, add the sample data:
233211
234212 ` ` ` sh
235- FAUNA_SECRET=<secret> ./setup .sh
213+ FAUNA_SECRET=< secret> ./scripts/seed .sh
236214 ` ` `
237215
238216 If the app server is running, stop the server by pressing Ctrl+C.
@@ -263,21 +241,25 @@ Customer documents and related API responses:
263241 database to stage the changes:
264242
265243 ` ` ` sh
266- fauna schema push
244+ fauna schema push \
245+ --database us/ECommerceJava
267246 ` ` `
268247
269248 When prompted, accept and stage the schema.
270249
2712504. Check the status of the staged schema:
251+
272252 ` ` ` sh
273- fauna schema status
253+ fauna schema status \
254+ --database us/ECommerceJava
274255 ` ` `
275256
2762575. When the status is ` ready` , commit the staged schema changes to the
277258 database:
278259
279260 ` ` ` sh
280- fauna schema commit
261+ fauna schema commit \
262+ --database us/ECommerceJava
281263 ` ` `
282264
2832656. In ` CustomersController.java` , add the
0 commit comments