A simple Web API for event- and participant management used in Docker and Kubernetes workshops
10K+
This sample image implements a simple RESTful Web API for event- and participant management. It is implemented in Node.js and uses MongoDB to store data. I use this image in Docker and Kubernetes trainings.
This sample also contains an OpenAPI specification for the Web API. I use it in workshops to speak about Swagger and OpenAPI. Here are the links to the specifications:
Pull the latest image:
docker pull rstropek/node-mongo-sample
This Web API will need a MongoDB to store data. If you don't have one, you can run it in a container:
docker run --name event-db -d mongo
Run the Web API:
docker run -e MONGO_URL=mongodb://event-db/member-management --link event-db -p 1337:80 -d --name event-api rstropek/node-mongo-sample
Try accessing the Web API. Here are some sample requests you can try:
GET http://localhost:1337/api/events?past=true
Accept: application/json
###
POST http://localhost:1337/api/events
Content-Type: application/json
Accept: application/json
{
"date": "2018-03-21T00:00:00",
"location": "Linz"
}
###
POST http://localhost:1337/api/events/5ab1f7783907dc5490a62a26/registrations
Content-Type: application/json
Accept: application/json
{
"participant":
{
"givenName": "John",
"familyName": "Doe"
}
}
###
GET http://localhost:1337/api/events/5ab1f7783907dc5490a62a26/registrations
Accept: application/json
###
POST http://localhost:1337/api/participants/5ab1f82465ab325e8356f183/checkin/5ab1f7783907dc5490a62a26
Content-Type: application/json
Accept: application/json
Content type
Image
Digest
Size
34.5 MB
Last updated
almost 7 years ago
docker pull rstropek/node-mongo-sample