Skip to content

Commit c7ba62d

Browse files
committed
Added initial set of files based on the EventStoreDB starter
1 parent a60866e commit c7ba62d

32 files changed

+8946
-2
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules/
2+
**/dist/
3+
**/*.d.ts
4+
/src/types/

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf

.eslintignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/node_modules/*
2+
# build artifacts
3+
dist/*coverage/*
4+
5+
# data definition files
6+
**/*.d.ts
7+
8+
# custom definition files
9+
/src/types/
10+
11+
!.eslintrc.js

.eslintrc.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"env": {
3+
"es2023": true,
4+
"node": true
5+
},
6+
"plugins": ["@typescript-eslint"],
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
11+
"plugin:prettier/recommended"
12+
],
13+
"parser": "@typescript-eslint/parser",
14+
"parserOptions": {
15+
"ecmaVersion": 2023,
16+
"sourceType": "module",
17+
"project": "./tsconfig.json"
18+
},
19+
"rules": {
20+
"no-unused-vars": "off",
21+
"@typescript-eslint/no-unused-vars": [
22+
"error",
23+
{ "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }
24+
],
25+
"@typescript-eslint/no-misused-promises": ["off"],
26+
"@typescript-eslint/prefer-namespace-keyword": "off"
27+
},
28+
"settings": {
29+
"import/resolver": {
30+
"typescript": {}
31+
}
32+
}
33+
}

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: [oskardudycz]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/build_and_test.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and test Sample - WebApi with Express.js and EventStoreDB
2+
3+
on:
4+
# run it on push to the default repository branch
5+
push:
6+
branches: [main]
7+
# run it during pull request
8+
pull_request:
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
jobs:
14+
build-and-test-code:
15+
name: Build application code
16+
# use system defined below in the tests matrix
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Check Out Repo
21+
uses: actions/checkout@v4
22+
23+
- name: Use Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version-file: ./.nvmrc
27+
cache: 'npm'
28+
cache-dependency-path: './package-lock.json'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build TS
34+
run: npm run build:ts
35+
36+
- name: Run linting (ESlint and Prettier)
37+
run: npm run lint
38+
39+
- name: Build
40+
run: npm run build
41+
42+
- name: Test
43+
run: npm run test
44+
45+
- name: Set up Docker Buildx
46+
id: buildx
47+
uses: docker/setup-buildx-action@v2
48+
49+
- name: Build Docker
50+
id: docker_build
51+
uses: docker/build-push-action@v4
52+
with:
53+
push: false
54+
tags: emmett.esdb.sample:latest
55+
56+
- name: Image digest
57+
run: echo ${{ steps.docker_build.outputs.digest }}

.gitignore

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

.http

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@clientId = dummy
2+
@productId = dummy
3+
@unitPrice = 100
4+
5+
### Add Product
6+
7+
POST http://localhost:3000/clients/{{clientId}}/shopping-carts/current/product-items HTTP/1.1
8+
content-type: application/json
9+
10+
{
11+
"productId": "{{productId}}",
12+
"quantity": 10
13+
}
14+
15+
### Get State
16+
17+
GET http://localhost:3000/clients/{{clientId}}/shopping-carts/current HTTP/1.1
18+
content-type: application/json
19+
20+
21+
### Remove Product
22+
23+
@quantity = 1
24+
25+
DELETE http://localhost:3000/clients/{{clientId}}/shopping-carts/current/product-items?productId={{productId}}&quantity={{quantity}}&unitPrice={{unitPrice}} HTTP/1.1
26+
content-type: application/json
27+
28+
### CONFIRM
29+
30+
POST http://localhost:3000/clients/{{clientId}}/shopping-carts/current/confirm HTTP/1.1
31+
content-type: application/json
32+
33+
34+
### Cancel
35+
36+
POST http://localhost:3000/clients/{{clientId}}/shopping-carts/current HTTP/1.1
37+
content-type: application/json

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.11.1

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/dist/
2+
**/lib/

.prettierrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"tabWidth": 2,
3+
"singleQuote": true
4+
}

.vscode/Node.js.code-profile

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

.vscode/launch.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug current file",
6+
"type": "node",
7+
"request": "launch",
8+
9+
// Debug current file in VSCode
10+
"program": "${file}",
11+
12+
/*
13+
Path to tsx binary
14+
Assuming locally installed
15+
*/
16+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tsx",
17+
18+
/*
19+
Open terminal when debugging starts (Optional)
20+
Useful to see console.logs
21+
*/
22+
"console": "integratedTerminal",
23+
"internalConsoleOptions": "neverOpen",
24+
25+
// Files to exclude from debugger (e.g. call stack)
26+
"skipFiles": [
27+
// Node.js internal core modules
28+
"<node_internals>/**",
29+
30+
// Ignore all dependencies (optional)
31+
"${workspaceFolder}/node_modules/**"
32+
]
33+
},
34+
{
35+
"name": "Debug All Tests (Node)",
36+
"type": "node",
37+
"request": "launch",
38+
"skipFiles": ["<node_internals>/**"],
39+
"runtimeExecutable": "npm",
40+
"runtimeArgs": [
41+
"run-script",
42+
"test",
43+
"--inspect-brk=9229",
44+
"--preserve-symlinks"
45+
], // Use --inspect-brk for debugging
46+
"console": "integratedTerminal",
47+
"internalConsoleOptions": "neverOpen",
48+
"cwd": "${workspaceFolder}",
49+
"sourceMaps": true,
50+
"smartStep": true,
51+
"resolveSourceMapLocations": [
52+
"${workspaceFolder}/**",
53+
"!**/node_modules/**",
54+
"node_modules/@event-driven.io/emmett-expressjs/**/*.*"
55+
]
56+
}
57+
]
58+
}

.vscode/settings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnPaste": false,
4+
"editor.formatOnSave": true,
5+
6+
"editor.codeActionsOnSave": {
7+
"source.organizeImports": "explicit",
8+
"source.fixAll.eslint": "explicit",
9+
"source.addMissingImports": "always"
10+
},
11+
12+
"editor.tabSize": 2,
13+
14+
"files.exclude": {
15+
"**/*.tsbuildinfo": true
16+
},
17+
"files.eol": "\n",
18+
19+
"typescript.preferences.importModuleSpecifier": "relative",
20+
"eslint.workingDirectories": [{ "mode": "auto" }],
21+
"debug.javascript.terminalOptions": {
22+
"nodeVersionHint": 20
23+
}
24+
}

0 commit comments

Comments
 (0)