mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 03:57:13 -05:00
Add express scaffolding for backend services
This commit is contained in:
1752
blackroad-os-core/package-lock.json
generated
Normal file
1752
blackroad-os-core/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
blackroad-os-core/package.json
Normal file
23
blackroad-os-core/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "blackroad-os-core",
|
||||
"version": "0.1.0",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"dev": "ts-node-dev --respawn --transpile-only src/index.ts",
|
||||
"build": "tsc",
|
||||
"start": "node dist/index.js",
|
||||
"health": "curl -f http://localhost:8080/health || exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.11.0",
|
||||
"ts-node-dev": "^2.0.0",
|
||||
"typescript": "^5.6.0"
|
||||
}
|
||||
}
|
||||
31
blackroad-os-core/src/index.ts
Normal file
31
blackroad-os-core/src/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import express from "express";
|
||||
import cors from "cors";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
const PORT = process.env.PORT || 8080;
|
||||
const SERVICE_NAME = "blackroad-os-core";
|
||||
|
||||
app.get("/", (_req, res) => {
|
||||
res.json({
|
||||
service: SERVICE_NAME,
|
||||
status: "ok",
|
||||
message: "BlackRoad OS Core root"
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/health", (_req, res) => {
|
||||
res.json({
|
||||
service: SERVICE_NAME,
|
||||
status: "ok"
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`✅ ${SERVICE_NAME} listening on port ${PORT}`);
|
||||
});
|
||||
13
blackroad-os-core/tsconfig.json
Normal file
13
blackroad-os-core/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2019",
|
||||
"module": "commonjs",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user