You have two options:
Option one (recommended):
- install
devenv&& rundevenv up - done.
Now you can run dev, fmt, etc. (tasks are defined in tasks.nix)
Option two: follow Cloudflare's guide
Note
the rest of the guide assumes you're using devenv
if you're installing stuff manully,
take a look at tasks.nix for the commands
Once you've installed the prerequisites, you can run:
dev server
devrowser-based sqlite viewer
d1-viewerseed local d1 database with data
d1-seedshorten a URL
curl --url http://localhost:8787/create \
--request 'POST' \
--data-binary 'https://docs.union.build/reference/graphql/?query=%7B%20__typename%20%7D'now refresh the d1 viewer page and you should see the new record
Note
When running locally use http://localhost:8787
curl --url http://localhost:8787/create \
--request 'POST' \
--data-binary 'https://docs.union.build/reference/graphql/?query=%7B%20__typename%20%7D'This will return a short the shortened URL, for example:
# example
https://localhost/26curl --url http://localhost:8787/26