https://github.com/datastaxdevs/spring-boot-astra-data-api
TodoList with Spring Boot and AstraDB using Data API
https://github.com/datastaxdevs/spring-boot-astra-data-api
Last synced: 10 months ago
JSON representation
TodoList with Spring Boot and AstraDB using Data API
- Host: GitHub
- URL: https://github.com/datastaxdevs/spring-boot-astra-data-api
- Owner: datastaxdevs
- Created: 2025-02-17T10:12:51.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-02-17T14:07:45.000Z (12 months ago)
- Last Synced: 2025-02-17T15:23:12.726Z (12 months ago)
- Language: Java
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Installation
- Clone the repository
```console
git@github.com:datastaxdevs/spring-boot-astra-spring-data-cassandra.git
```
- 1. Create an account in Astra DB for free
https://astra.datastax.com/
- 2. Create a Database
https://docs.datastax.com/en/astra-db-serverless/databases/create-database.html
- 3. Create an Application token
https://docs.datastax.com/en/astra-db-serverless/administration/manage-application-tokens.html
## Setup
- Open `application.propoerties` and change `datastax.astra.token` with your token and `datastax.astra.endpoint` with the endpoint of your database
```ini
datastax.astra.token=
datastax.astra.endpoint=
```
## use the application
- Start the application (first start could take up a few seconds as the table is created for you)
```bash
mvn spring-boot:run
```
- List your todos (or in your browser [http://localhost:8080/tables/todos](http://localhost:8080/todos))
```bash
curl -X GET http://localhost:8080/collections/todos
curl -X GET http://localhost:8080/tables/todos
```
- Create a todo
```bash
curl -X POST http://localhost:8080/collections/todos \
-H "Content-Type: application/json" \
-d '{"title": "New Todo", "description": "Todo details", "completed": false}'
curl -X POST http://localhost:8080/tables/todos \
-H "Content-Type: application/json" \
-d '{"title": "New Todo", "description": "Todo details", "completed": false}'
```
- You can go data explorer:
