Exercise: Create a CRUD Service
This page lists an exercise for adding a new MongoDB-backed state to Train CRUD and exposing it as a /test endpoint.
This exercise extends the existing Train CRUD runner with a new state. The result is a new CRUD endpoint under the runner. The endpoint reads and writes to a MongoDB collection automatically.
Before you start
You can access the Devops app.
The training deployment is installed and
train_crudis running.You know your API base URL:
https://[YOUR_ADMIN_API_DOMAIN].
What you’ll build
A new state with alias
test.A new endpoint:
https://[YOUR_ADMIN_API_DOMAIN]/api/request/train_crud/test
Configure it as Generic Master + alias test
In the editor:
Choose Generic Master.
Set alias to
test.
Generic Master creates a simple MongoDB-backed state manager on the master database. The alias becomes:
the CRUD URL segment (
/test)the MongoDB collection name (
test)
This is the simplest “new CRUD resource” configuration. For advanced options, use the Devops docs referenced from the CRUD runner section.
Wait for rebuild and test the endpoint
The training Train CRUD runner is typically configured to rebuild every ~30 seconds. After you save, give it a moment to apply the new state.
Then call:
https://[YOUR_ADMIN_API_DOMAIN]/api/request/train_crud/test
Expected result:
HTTP
200 OKBody:
{list: []}(the collection starts empty)
Full list of supported CRUD operations and parameters is in CRUD event runner.
Troubleshooting
404 Not Found: confirm the alias is
testand that you saved the runner. Then wait for the rebuild interval.500 errors:
Generic Masterpoints to a MongoDB connection. Check the master DB is reachable.Endpoint exists but returns nothing: verify you are hitting
train_crud(URL contains/train_crud/).
Last updated



