build: fix tsconfig

This commit is contained in:
eneller
2026-02-28 01:19:35 +01:00
parent e64a77a0d7
commit 05090ebb14
9 changed files with 1355 additions and 4 deletions

View File

@@ -7,7 +7,10 @@
"type": "commonjs",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"start": "ts-node src/index.ts",
"build": "tsc",
"serve": "node ../dist/out-tsc/server/index.js"
},
"dependencies": {
"cors": "^2.8.6",
@@ -15,5 +18,16 @@
"express": "^5.2.1",
"pg": "^8.19.0",
"sequelize": "^6.37.7"
},
"devDependencies": {
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/node": "^25.3.2",
"@types/pg": "^8.16.0",
"eslint": "^10.0.2",
"nodemon": "^3.1.14",
"prettier": "^3.8.1",
"ts-node": "^10.9.2",
"typescript": "^5.9.3"
}
}

7
server/src/db.ts Normal file
View File

@@ -0,0 +1,7 @@
const { Pool } = require("pg");
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
});
module.exports = pool;

19
server/src/index.ts Normal file
View File

@@ -0,0 +1,19 @@
import express, { Express, Request, Response } from "express";
import cors from "cors";
import * as dotenv from "dotenv";
dotenv.config();
const app: Express = express();
app.use(cors());
app.use(express.json());
app.get("/api/health", (req: Request, res: Response) => {
res.json({ status: "OK" });
});
const PORT: number = parseInt(process.env.PORT as string) || 3000;
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});

13
server/tsconfig.json Normal file
View File

@@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../dist/out-tsc/server",
"module": "commonjs",
"esModuleInterop": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
}