vue-todo/README.md
2023-11-17 16:04:52 +01:00

2.5 KiB

basebox Sample: TODO App

This project implements the Hello World of API-driven apps: a simple TODO app, built with Vue 3.

Quick instructions

If you have docker installed:-

  • docker compose up in a terminal window
  • Go to http://127.0.0.1:5167/ in your browser

For more information, see as follows.

Requirements:-

Running instructions:-

  • docker compose up

This will download the basebox Docker images, a postgres instance and the demo application.

Once Docker is up and running, you should be able to go to your browser and navigate to http://127.0.0.1:5167/ to view the demo.

Note that if this does not work, find the npm console out (you should find the output in the Docker terminal window), which will look like the following:-


  VITE v4.1.4  ready in 273 ms

  ➜  Local:   http://localhost:5167/
  ➜  Network: use --host to expose
  ➜  press h to show help

Use the url publish here to view the demo.

The bbconf folder contains basebox GraphQL schema, config files, precompiled database schema, type maps etc. The GraphQL schema is the central file of basebox, from this we generate the database and create GraphQL operations to query and mutate the database. Please have a look at bbconf\basebox\schema.graphql to get an idea of what this looks like.

Terminal output

We have intentionally put the basebox servers (the broker and the dbproxy) into tracing mode (this is configured in the config files in bbconf/basebox) so you can see more of what's happening behind the scenes while using the front-end application. Now of the SQL generated is hardcoded, they are all converted directly from the GraphQL requests.

Compiling

The basebox compiler (bbc) compiles the GraphQL schema into a database script (this is used to create the database for our backend service), a resolver file that is used by the dbproxy to query and mutate the database, and a typemap file that is also used by the dbproxy to map GraphQL and database types together.

You can make changes to the schema files and generated new config files (liek the database script), this is how you would run the basebox compiler (bbc)

docker run --rm -v ./../bbconf/basebox/:/bbconf --name bbc gitea.basebox.health/basebox-distribution/bbc:latest /bbconf/schema.graphql --prefix bbtest -o /bbconf/

Note that it's better to make a copy of the schema first and use that as changes would not necessarily work with the front-end/vue application.