Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSv2 Guestbook #237

Merged
merged 14 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions .github/workflows/greeting-guestbook.yml

This file was deleted.

4 changes: 0 additions & 4 deletions typescript/greeting-guestbook/.eslintignore

This file was deleted.

19 changes: 0 additions & 19 deletions typescript/greeting-guestbook/.eslintrc

This file was deleted.

146 changes: 146 additions & 0 deletions typescript/greeting-guestbook/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# DBOS-specific
.dbos


# Logs
**/.DS_Store
**/prisma/migrations/*
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
dbos_deploy/

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# VSCode settings
.vscode/settings.json

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Editor temp/recovery files
*.swp
*.swo
7 changes: 0 additions & 7 deletions typescript/greeting-guestbook/.vscode/extensions.json

This file was deleted.

22 changes: 0 additions & 22 deletions typescript/greeting-guestbook/.vscode/launch.json

This file was deleted.

17 changes: 0 additions & 17 deletions typescript/greeting-guestbook/.vscode/tasks.json

This file was deleted.

45 changes: 17 additions & 28 deletions typescript/greeting-guestbook/README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
# DBOS Guestbook Hello App
# Greeting Guestbook

This is the app described in the [DBOS Programming Guide](https://docs.dbos.dev/getting-started/quickstart-programming)
This is the completed app described in the [DBOS TypeScript Programming Guide](https://docs.dbos.dev/typescript/programming-guide).

## Getting Started
### Running Locally

First, install all the app dependencies
```bash
npm install
```

Start the database. You can use any Postgres DB. If you don't have one, we've provided a script that starts Postgres locally in a Docker container and creates a database:
To run this app locally, you need a Postgres database.
If you have Docker, you can start one with:

```bash
export PGPASSWORD=dbos #set PGPASSWORD=dbos on Windows
```shell
export PGPASSWORD=dbos
node start_postgres_docker.js
```

Then, create some database tables.

```bash
npx dbos migrate
```

Then, visit the guestbook key generator at [https://demo-guestbook.cloud.dbos.dev/key](https://demo-guestbook.cloud.dbos.dev/key) and save your key to `dbos-config.yaml`

Next, build and run the app:
Then run:

```bash
```shell
npm install
npm run build
npx dbos start
npx dbos migrate
npm run start
```

Finally, curl the server to see that it's working!
or simply:

```bash
curl http://localhost:3000/greeting/dbos
```shell
npm install
npm run dev
```

## Learn More

To learn more about DBOS, take a look at [our documentation](https://docs.dbos.dev/) or our [source code](https://github.com/dbos-inc/dbos-transact).
Visit [`http://localhost:3000/greeting/dbos`](http://localhost:3000/greeting/dbos) to try out the app!
20 changes: 11 additions & 9 deletions typescript/greeting-guestbook/dbos-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@

# yaml-language-server: $schema=https://raw.githubusercontent.com/dbos-inc/dbos-transact/main/dbos-config.schema.json

language: node
database:
hostname: 'localhost'
hostname: localhost
port: 5432
username: 'postgres'
username: postgres
password: ${PGPASSWORD}
app_db_name: 'hello_guestbook'
connectionTimeoutMillis: 3000
app_db_client: 'knex'
migrate: ['npx knex migrate:latest']
rollback: ['npx knex migrate:rollback']
env:
GUESTBOOK_KEY: 'your-key-here' #visit https://demo-guestbook.cloud.dbos.dev/key to create a key

app_db_client: knex
migrate:
- npx knex migrate:latest
rollback:
- npx knex migrate:rollback
runtimeConfig:
start:
- node dist/main.js
Loading
Loading