Skip to content

Commit a87e2d6

Browse files
committed
feat: step 2
1 parent 9adafe2 commit a87e2d6

File tree

10 files changed

+169
-16
lines changed

10 files changed

+169
-16
lines changed

funpets-server/.funcignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.js.map
2+
*.ts
3+
.git*
4+
.vscode
5+
local.settings.json
6+
test
7+
tsconfig.json
8+
node_modules

funpets-server/host.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"version": "2.0"
3+
}

funpets-server/local.settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"IsEncrypted": false,
3+
"Values": {
4+
"FUNCTIONS_WORKER_RUNTIME": "node"
5+
}
6+
}

funpets-server/main/function.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"bindings": [
3+
{
4+
"authLevel": "anonymous",
5+
"type": "httpTrigger",
6+
"direction": "in",
7+
"name": "req",
8+
"route": "{*segments}"
9+
},
10+
{
11+
"type": "http",
12+
"direction": "out",
13+
"name": "res"
14+
}
15+
],
16+
"scriptFile": "../dist/main/index.js"
17+
}

funpets-server/main/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Context, HttpRequest } from '@azure/functions';
2+
import { AzureHttpAdapter } from '@nestjs/azure-func-http';
3+
import { createApp } from '../src/main.azure';
4+
5+
export default function(context: Context, req: HttpRequest): void {
6+
AzureHttpAdapter.handle(createApp, context, req);
7+
}

funpets-server/main/sample.dat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "Azure"
3+
}

funpets-server/package-lock.json

Lines changed: 106 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

funpets-server/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
"test:watch": "jest --watch",
1818
"test:cov": "jest --coverage",
1919
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20-
"test:e2e": "jest --config ./test/jest-e2e.json"
20+
"test:e2e": "jest --config ./test/jest-e2e.json",
21+
"start:azure": "npm run build && func host start"
2122
},
2223
"dependencies": {
24+
"@azure/functions": "^1.0.3",
25+
"@nestjs/azure-func-http": "^0.4.1",
2326
"@nestjs/common": "^6.7.2",
2427
"@nestjs/core": "^6.7.2",
2528
"@nestjs/platform-express": "^6.7.2",

funpets-server/proxies.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "http://json.schemastore.org/proxies",
3+
"proxies": {}
4+
}

funpets-server/src/main.azure.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { INestApplication } from '@nestjs/common';
2+
import { NestFactory } from '@nestjs/core';
3+
import { AppModule } from './app.module';
4+
5+
export async function createApp(): Promise<INestApplication> {
6+
const app = await NestFactory.create(AppModule);
7+
app.setGlobalPrefix('api');
8+
9+
await app.init();
10+
return app;
11+
}

0 commit comments

Comments
 (0)