🏗️」 wip: work in progress, not done yet.

This commit is contained in:
2025-07-10 16:32:08 +02:00
parent 94644f0671
commit 16df5bfce4
5 changed files with 45 additions and 4 deletions

View File

@ -9,7 +9,7 @@ user:
fastify start src/api/user/default.js
apis:
node dev.js
node src/dev.js
front:
vite

4
dev.js
View File

@ -1,6 +1,6 @@
import Fastify from 'fastify';
import authApi from './src/api/auth/default.js';
import userApi from './src/api/user/default.js';
import authApi from './api/auth/default.js';
import userApi from './api/user/default.js';
const loggerOption = {
transport: {

View File

@ -122,10 +122,12 @@ export default async function(fastify, options) {
// POST
fastify.post('/users/:userId', { preHandler: [fastify.authenticateAdmin] }, async (request, reply) => {
try {
const userId = request.params.userId;
if (getUserInfo.get(userId)) {
return reply.code(400).send({ error: "User already exist" });
}
createUser.run(request.params.userId, request.params.userId);
createUser.run(userId, userId);
return reply.code(200).send({ msg: "User created sucessfully" });
} catch (err) {
fastify.log.error(err);

32
src/dev.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);

7
tailwind.config.js Normal file
View File

@ -0,0 +1,7 @@
export default {
content: ['./src/front/**/*.{html,js}'],
theme: {
extend: {},
},
plugins: [],
}