🏗️」 wip: dev.js -> start.js and working user api docker

This commit is contained in:
2025-07-15 15:44:15 +02:00
parent 05af515788
commit 59ee24b046
5 changed files with 67 additions and 2 deletions

View File

@ -6,5 +6,15 @@ services:
# environment:
# - euuuh
user-api:
image:
cmd:
build:
dockerfile: docker/user-api/Dockerfile
context: ..
networks:
- transcendence
ports:
- 3000:3000
networks:
transcendence:
external: false
name: transcendence

View File

@ -0,0 +1,6 @@
FROM node-base
EXPOSE 3000
ENV API_TARGET="user"
CMD [ "node", "/app/src/start.js" ]

32
docker/user-api/start.js Normal file
View File

@ -0,0 +1,32 @@
import Fastify from 'fastify';
import authApi from './api/auth/default.js';
import userApi from './api/user/default.js';
const loggerOption = {
transport: {
target: 'pino-pretty',
options: {
colorize: true,
translateTime: 'HH:MM:ss',
ignore: 'pid,hostname'
}
}
};
async function start() {
const auth = Fastify({
logger: loggerOption
});
auth.register(authApi);
await auth.listen({ port: 3001 });
console.log('Auth API listening on http://localhost:3001');
const user = Fastify({
logger: loggerOption
});
user.register(userApi);
await user.listen({ port: 3002 });
console.log('User data API listening on http://localhost:3002');
}
start().catch(console.error);