Skip to content

Commit 6df52d5

Browse files
authored
Merge pull request #28 from restackio/express-2
2 parents 5947df8 + 0a2aa24 commit 6df52d5

File tree

10 files changed

+2615
-1
lines changed

10 files changed

+2615
-1
lines changed

examples/express/.env.Example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# (Optional) Restack Cloud - You only need to set these if you are using Restack Cloud
2+
3+
RESTACK_ENGINE_ID=
4+
RESTACK_ENGINE_ADDRESS=
5+
RESTACK_ENGINE_API_KEY=
6+
7+
RESTACK_CLOUD_TOKEN=

examples/express/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Build stage
2+
FROM node:20-bullseye-slim AS builder
3+
4+
WORKDIR /app
5+
6+
# Install pnpm
7+
RUN npm install -g pnpm
8+
9+
# Copy package files
10+
COPY package*.json ./
11+
12+
# Install dependencies including TypeScript
13+
RUN pnpm install
14+
RUN pnpm add -D typescript
15+
16+
# Copy source code
17+
COPY . .
18+
19+
# Build TypeScript code
20+
RUN pnpm run build
21+
22+
# Production stage
23+
FROM node:20-bullseye-slim
24+
25+
WORKDIR /app
26+
27+
# Install pnpm
28+
RUN npm install -g pnpm
29+
30+
# Copy package files and built code
31+
COPY --from=builder /app/package*.json ./
32+
COPY --from=builder /app/dist ./dist
33+
34+
# Install production dependencies only
35+
RUN pnpm install --prod
36+
37+
EXPOSE 8000
38+
39+
CMD ["node", "dist/server.js"]

examples/express/package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "restack-examples-ts-express",
3+
"version": "0.0.1",
4+
"description": "Basic Express example",
5+
"main": "server.ts",
6+
"scripts": {
7+
"start": "ts-node src/server.ts",
8+
"start.watch": "nodemon src/server.ts",
9+
"dev": "pnpm start.watch",
10+
"build": "tsc --build",
11+
"clean": "rm -rf node_modules",
12+
"docker:build": "docker build -t restack-express .",
13+
"docker:run": "docker run -p 8000:8000 restack-express",
14+
"docker:dev": "pnpm docker:build && pnpm docker:run",
15+
"restack-up": "node restack_up.mjs"
16+
},
17+
"nodemonConfig": {
18+
"execMap": {
19+
"ts": "ts-node"
20+
},
21+
"ext": "ts",
22+
"watch": [
23+
"src"
24+
]
25+
},
26+
"dependencies": {
27+
"@restackio/ai": "^0.0.80",
28+
"@temporalio/workflow": "^1.11.2",
29+
"dotenv": "^16.4.5",
30+
"express": "^4.21.1"
31+
},
32+
"devDependencies": {
33+
"@restackio/restack-sdk-cloud-ts": "^1.0.15",
34+
"@types/express": "^5.0.0",
35+
"@types/node": "^20.16.9",
36+
"nodemon": "^2.0.22",
37+
"ts-node": "^10.9.2"
38+
}
39+
}

0 commit comments

Comments
 (0)