Skip to content

Commit

Permalink
rename JSON_API -> DATA_API in photography app
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jan 5, 2025
1 parent 7f9461c commit 91b3667
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
12 changes: 5 additions & 7 deletions photography-site-demo.js/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ IS_ASTRA=
#Nomic api key for generating embeddings
NOMIC_API_KEY=

#Fill the Local JSON API related details only when IS_ASTRA is set to 'false'
#Local JSON API URL for example: http://127.0.0.1:8181/v1/photography where 'photography' is the keyspace name
JSON_API_URL=
#Auth URL for example: http://127.0.0.1:8081/v1/auth
JSON_API_AUTH_URL=
#Fill the Local Data API related details only when IS_ASTRA is set to 'false'
#Local Data API URL for example: http://127.0.0.1:8181/v1/photography where 'photography' is the keyspace name
DATA_API_URL=
#Auth username and password
JSON_API_AUTH_USERNAME=
JSON_API_AUTH_PASSWORD=
DATA_API_AUTH_USERNAME=
DATA_API_AUTH_PASSWORD=

#Fill the ASTRA DB related details only when IS_ASTRA is set to 'true'
#Astra DB API URL
Expand Down
7 changes: 3 additions & 4 deletions photography-site-demo.js/.env.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
JSON_API_URL=http://127.0.0.1:8181/v1/photography
JSON_API_AUTH_URL=http://127.0.0.1:8081/v1/auth
JSON_API_AUTH_USERNAME=cassandra
JSON_API_AUTH_PASSWORD=cassandra
DATA_API_URL=http://127.0.0.1:8181/v1/photography
DATA_API_AUTH_USERNAME=cassandra
DATA_API_AUTH_PASSWORD=cassandra
10 changes: 4 additions & 6 deletions photography-site-demo.js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# photography-site

This sample app demonstrates a photography site by using [`express`](https://www.npmjs.com/package/express), [`mongoose`](https://github.com/Automattic/mongoose) and [`stargate-mongoose`](https://github.com/stargate/stargate-mongoose).
This sample app demonstrates a photography site by using [`express`](https://www.npmjs.com/package/express), [`mongoose`](https://github.com/Automattic/mongoose) and [`stargate-mongoose`](https://github.com/stargate/stargate-mongoose).

## Environment

Expand Down Expand Up @@ -38,10 +38,9 @@ Make sure you have Node.js 17 or higher
1. Copy the `.env.example` file to `.env` and fill in the values for the environment variables.
2. Set `IS_ASTRA` to `false`
3. Set `OPENAI_API_KEY` to your openAI api key
4. Set `JSON_API_URL` to `http://127.0.0.1:8181/v1/photography`
5. Set `JSON_API_AUTH_URL` to `http://127.0.0.1:8181/v1/auth`
6. Set `JSON_API_AUTH_USERNAME` to `cassandra`
7. Set `JSON_API_AUTH_PASSWORD` to `cassandra`
4. Set `DATA_API_URL` to `http://127.0.0.1:8181/v1/photography`
5. Set `DATA_API_AUTH_USERNAME` to `cassandra`
6. Set `DATA_API_AUTH_PASSWORD` to `cassandra`



Expand All @@ -51,4 +50,3 @@ Make sure you have Node.js 17 or higher
2. Run `npm run seed`
3. Run `npm start`
4. Visit `http://127.0.0.1:3000` to see the UI

9 changes: 4 additions & 5 deletions photography-site-demo.js/server/models/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ module.exports = async function connect() {
isAstra: true
};
} else {
uri = process.env.JSON_API_URL;
uri = process.env.DATA_API_URL;
jsonApiConnectOptions = {
username: process.env.JSON_API_AUTH_USERNAME,
password: process.env.JSON_API_AUTH_PASSWORD,
authUrl: process.env.JSON_API_AUTH_URL
username: process.env.DATA_API_AUTH_USERNAME,
password: process.env.DATA_API_AUTH_PASSWORD
};
}
await mongoose.connect(uri, jsonApiConnectOptions);
await Promise.all(Object.values(mongoose.connection.models).map(Model => Model.init()));
return conn;
};
};

0 comments on commit 91b3667

Please sign in to comment.