We at Injee are pleased to announce the release of Injee 0.4.0. Sometimes one need to delete all data in table and get it clean, and we have an api for that.
So let’s start our injee:
$ curl -L https://yu7.in/run-injee | sh
Now let’s create a user:
$ curl -X POST http://localhost:4125/api/users \
-H "Content-Type: application/json" \
-d '{"name": "Aravindan", "country": "Sri Lanka"}'
So we get a confirmation of the creation:
{
"name": "Aravindan",
"country": "Sri Lanka",
"created_at": "2024-08-21T15:04:25Z",
"updated_at": "2024-08-21T15:04:25Z",
"id": "a65cf235-2a0e-4ca2-9114-79fb3722184d"
}
Now let’s create a book:
$ curl -X POST http://localhost:4125/api/books \
-H "Content-Type: application/json" \
-d '{"title": "Adventures of Huckleberry Finn", "author": "Mark Twain"}'
As we see below it’s created successfully:
{
"title": "Adventures of Huckleberry Finn",
"author": "Mark Twain",
"created_at": "2024-08-21T15:04:32Z",
"updated_at": "2024-08-21T15:04:32Z",
"id": "8f0df4e3-bc34-4dd2-a979-39469168bf10"
}
Let’s list tables:
$ curl -X GET http://localhost:4125/ops/tables
As we see below there are two tables, users
and books
:
[
"users",
"books"
]
Now let’s delete the table users
:
$ curl -X DELETE http://localhost:4125/api/delete-table/users
We get a message as shown below, informing us that the table has been deleted:
{
"message": "deleted table users"
}
Now let’s list tables:
$ curl -X GET http://localhost:4125/ops/tables
As you can see below, we don’t see users
table anymore.
[
"books"
]
In the terminal where injee is started, hit CTRL+C
to stop it.