Skip to content

Commit 6310132

Browse files
author
mmrt
committed
errors gone
1 parent 2183178 commit 6310132

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

bridge/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "bridge",
33
"version": "0.1.0",
44
"description": "",
5+
"types": "./dist/index.d.ts",
56
"main": "index.js",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1"

bridge/tsconfig.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
"compilerOptions": {
33

44
/* Language and Environment */
5-
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
5+
"target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
66

77
/* Modules */
8-
"module": "commonjs", /* Specify what module code is generated. */
8+
"module": "esnext", /* Specify what module code is generated. */
99
"rootDir": "./src", /* Specify the root folder within your source files. */
1010
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
1111
"outDir": "./dist", /* Specify an output folder for all emitted files. */
1212
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
1313
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
1414

1515
/* Type Checking */
16+
"declaration": true,
1617
"strict": true, /* Enable all strict type-checking options. */
1718
}
1819
}

server/package.json

+6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010
"author": "",
1111
"license": "ISC",
1212
"devDependencies": {
13+
"@koa/cors": "^3.1.0",
1314
"@types/cors": "^2.8.12",
1415
"@types/express": "^4.17.13",
16+
"@types/koa-bodyparser": "^4.3.5",
17+
"@types/koa-router": "^7.4.4",
1518
"@types/node": "^17.0.14",
19+
"cors": "link:@types/@koa/cors",
20+
"koa": "^2.13.4",
21+
"koa-router": "^10.1.1",
1622
"tsc": "^2.0.4",
1723
"typescript": "^4.5.5"
1824
}

server/src/server.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import express, {Application, Router} from 'express';
2-
import cors from 'cors';
1+
import Application from 'koa';
2+
import Router from 'koa-router';
33
import {METHOD_NOT_FOUND, Request, Response} from "../../bridge"
44
import {Bridge, BridgeImpl} from "../../bridge";
55

66
const bridge: Bridge = new BridgeImpl();
7+
const cors = require('@koa/cors');
78

89
const router = new Router();
910
router.post("/", async (ctx) => {
@@ -60,7 +61,7 @@ router.post("/", async (ctx) => {
6061
}
6162
})
6263

63-
const app:Application = express();
64+
const app:Application = new Application();
6465
app.use(
6566
cors({
6667
origin: "*",

server/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"target": "esnext",
4-
"module": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
4+
"module": "commonjs", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
55

66
"rootDir": "./src", /* Specify the root folder within your source files. */
77
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */

0 commit comments

Comments
 (0)