An api skeleton using mongodb for chubbyts-framework.
- node: 14
- @asteasolutions/zod-to-openapi: ^4.0.0
- @chubbyts/chubbyts-api: ^2.2.0
- @chubbyts/chubbyts-cors: ^1.0.3
- @chubbyts/chubbyts-decode-encode: ^1.1.1
- @chubbyts/chubbyts-dic: ^1.0.2
- @chubbyts/chubbyts-dic-config: ^1.0.2
- @chubbyts/chubbyts-dic-types: ^1.0.0
- @chubbyts/chubbyts-framework: ^1.6.3
- @chubbyts/chubbyts-framework-router-path-to-regexp: ^1.2.0
- @chubbyts/chubbyts-http: ^1.0.1
- @chubbyts/chubbyts-http-error: ^2.0.1
- @chubbyts/chubbyts-http-types: ^1.0.0
- @chubbyts/chubbyts-log-types: ^1.0.0
- @chubbyts/chubbyts-mongodb: ^1.0.1
- @chubbyts/chubbyts-negotiation: ^3.0.0
- @chubbyts/chubbyts-node-http-bridge: ^1.0.0
- @chubbyts/chubbyts-pino-adapter: ^1.1.1
- commander: ^9.4.1
- get-stream: ^6.0.1
- mongodb: ^4.13.0
- openapi3-ts: ^3.1.2
- pino: ^8.8.0
- uuid: ^9.0.0
- zod: ^3.20.2
Add the following environment variable to your system, for example within ~/.bashrc
:
export USER_ID=$(id -u)
export GROUP_ID=$(id -g)
docker-compose up -d
docker-compose exec node bash
npm install
npm start
- GET https://localhost/api/pets?sort[name]=asc
- POST https://localhost/api/pets
- GET https://localhost/api/pets/8ba9661b-ba7f-436b-bd25-c0606f911f7d
- PUT https://localhost/api/pets/8ba9661b-ba7f-436b-bd25-c0606f911f7d
- DELETE https://localhost/api/pets/8ba9661b-ba7f-436b-bd25-c0606f911f7d
Commands is code that is meant to be executed on command line.
Handler alias Controller, or Controller actions to be more precise.
Models, entities, documents what ever fits your purpose the best.
Repositories get data from storages like databases, elasticsearch, redis or whereever your models are stored or cached.
Service factories are the glue code of the dependeny injection container.
- Digitalocean
- Create digitalocean token
- Install digitalocean cli - doctl
- Pulumi
- Install pulumi cli - pulumi
- Install kubernetes cli - kubectl
cd pulumi
npm install
pulumi config set digitalocean:token XXXXXXXXXXXXXX --secret
pulumi config set chubbyts-petstore:certManagerEmail XXXXXXXXXXXXXX --secret
pulumi up
doctl registry login
doctl kubernetes clusters list
doctl kubernetes clusters kubeconfig save <clustername>
# lists all deployments: container definition(s) which provide(s) howto start a pod
kubectl get deployments
# show the current deployment definition
kubectl get deployment <deploymentname> -o yaml
# edit the current deployment defintion (should be done via code change and pulumi up, and not inline)
kubectl edit deployment <deploymentname>
# lists all pods: container(s) which provide(s) one application for example the cms
kubectl get pods
# show the current pod definition (do not edit!)
kubectl get pod <podname> -o yaml
# enter a pod
kubectl exec -it <podname> -- /bin/bash
2023 Dominik Zogg