build: fix tsconfig
This commit is contained in:
@@ -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
7
server/src/db.ts
Normal 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
19
server/src/index.ts
Normal 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
13
server/tsconfig.json
Normal 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"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user