Skip to content

Commit bcd0e75

Browse files
kraftpchuck-dbos
andauthored
TSv2 Guestbook (#237)
Co-authored-by: Chuck B <[email protected]>
1 parent 88274fc commit bcd0e75

19 files changed

+2619
-2621
lines changed

.github/workflows/greeting-guestbook.yml

-63
This file was deleted.

typescript/greeting-guestbook/.eslintignore

-4
This file was deleted.

typescript/greeting-guestbook/.eslintrc

-19
This file was deleted.
+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# DBOS-specific
2+
.dbos
3+
4+
5+
# Logs
6+
**/.DS_Store
7+
**/prisma/migrations/*
8+
logs
9+
*.log
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
lerna-debug.log*
14+
.pnpm-debug.log*
15+
dbos_deploy/
16+
17+
# Diagnostic reports (https://nodejs.org/api/report.html)
18+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
# Directory for instrumented libs generated by jscoverage/JSCover
27+
lib-cov
28+
29+
# Coverage directory used by tools like istanbul
30+
coverage
31+
*.lcov
32+
33+
# nyc test coverage
34+
.nyc_output
35+
36+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
37+
.grunt
38+
39+
# Bower dependency directory (https://bower.io/)
40+
bower_components
41+
42+
# node-waf configuration
43+
.lock-wscript
44+
45+
# Compiled binary addons (https://nodejs.org/api/addons.html)
46+
build/Release
47+
48+
# Dependency directories
49+
node_modules/
50+
jspm_packages/
51+
52+
# Snowpack dependency directory (https://snowpack.dev/)
53+
web_modules/
54+
55+
# TypeScript cache
56+
*.tsbuildinfo
57+
58+
# Optional npm cache directory
59+
.npm
60+
61+
# Optional eslint cache
62+
.eslintcache
63+
64+
# Optional stylelint cache
65+
.stylelintcache
66+
67+
# Microbundle cache
68+
.rpt2_cache/
69+
.rts2_cache_cjs/
70+
.rts2_cache_es/
71+
.rts2_cache_umd/
72+
73+
# Optional REPL history
74+
.node_repl_history
75+
76+
# Output of 'npm pack'
77+
*.tgz
78+
79+
# Yarn Integrity file
80+
.yarn-integrity
81+
82+
# dotenv environment variable files
83+
.env
84+
.env.development.local
85+
.env.test.local
86+
.env.production.local
87+
.env.local
88+
89+
# parcel-bundler cache (https://parceljs.org/)
90+
.cache
91+
.parcel-cache
92+
93+
# Next.js build output
94+
.next
95+
out
96+
97+
# Nuxt.js build / generate output
98+
.nuxt
99+
dist
100+
101+
# Gatsby files
102+
.cache/
103+
104+
# Comment in the public line in if your project uses Gatsby and not Next.js
105+
106+
# https://nextjs.org/blog/next-9-1#public-directory-support
107+
108+
# public
109+
110+
# vuepress build output
111+
.vuepress/dist
112+
113+
# vuepress v2.x temp and cache directory
114+
.temp
115+
116+
# Docusaurus cache and generated files
117+
.docusaurus
118+
119+
# Serverless directories
120+
.serverless/
121+
122+
# FuseBox cache
123+
.fusebox/
124+
125+
# DynamoDB Local files
126+
.dynamodb/
127+
128+
# TernJS port file
129+
.tern-port
130+
131+
# Stores VSCode versions used for testing VSCode extensions
132+
.vscode-test
133+
134+
# VSCode settings
135+
.vscode/settings.json
136+
137+
# yarn v2
138+
.yarn/cache
139+
.yarn/unplugged
140+
.yarn/build-state.yml
141+
.yarn/install-state.gz
142+
.pnp.*
143+
144+
# Editor temp/recovery files
145+
*.swp
146+
*.swo

typescript/greeting-guestbook/.vscode/extensions.json

-7
This file was deleted.

typescript/greeting-guestbook/.vscode/launch.json

-22
This file was deleted.

typescript/greeting-guestbook/.vscode/tasks.json

-17
This file was deleted.
+17-28
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,31 @@
1-
# DBOS Guestbook Hello App
1+
# Greeting Guestbook
22

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

5-
## Getting Started
5+
### Running Locally
66

7-
First, install all the app dependencies
8-
```bash
9-
npm install
10-
```
11-
12-
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:
7+
To run this app locally, you need a Postgres database.
8+
If you have Docker, you can start one with:
139

14-
```bash
15-
export PGPASSWORD=dbos #set PGPASSWORD=dbos on Windows
10+
```shell
11+
export PGPASSWORD=dbos
1612
node start_postgres_docker.js
1713
```
1814

19-
Then, create some database tables.
20-
21-
```bash
22-
npx dbos migrate
23-
```
24-
25-
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`
26-
27-
Next, build and run the app:
15+
Then run:
2816

29-
```bash
17+
```shell
18+
npm install
3019
npm run build
31-
npx dbos start
20+
npx dbos migrate
21+
npm run start
3222
```
3323

34-
Finally, curl the server to see that it's working!
24+
or simply:
3525

36-
```bash
37-
curl http://localhost:3000/greeting/dbos
26+
```shell
27+
npm install
28+
npm run dev
3829
```
3930

40-
## Learn More
41-
42-
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).
31+
Visit [`http://localhost:3000/greeting/dbos`](http://localhost:3000/greeting/dbos) to try out the app!

typescript/greeting-guestbook/dbos-config.yaml

+11-9
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33

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

6+
language: node
67
database:
7-
hostname: 'localhost'
8+
hostname: localhost
89
port: 5432
9-
username: 'postgres'
10+
username: postgres
1011
password: ${PGPASSWORD}
11-
app_db_name: 'hello_guestbook'
1212
connectionTimeoutMillis: 3000
13-
app_db_client: 'knex'
14-
migrate: ['npx knex migrate:latest']
15-
rollback: ['npx knex migrate:rollback']
16-
env:
17-
GUESTBOOK_KEY: 'your-key-here' #visit https://demo-guestbook.cloud.dbos.dev/key to create a key
18-
13+
app_db_client: knex
14+
migrate:
15+
- npx knex migrate:latest
16+
rollback:
17+
- npx knex migrate:rollback
18+
runtimeConfig:
19+
start:
20+
- node dist/main.js

0 commit comments

Comments
 (0)