Skip to content

Commit

Permalink
fix some minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
FreddyMSchubert committed Feb 18, 2025
1 parent a79535f commit 1405c98
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 46 deletions.
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ WORKDIR /app
COPY package*.json ./
RUN npm install --only=production

COPY --from=builder /app/back/build ./back/build
COPY --from=builder /app/back/db ./back/db
COPY --from=builder /app/front/assets ./assets/assets
COPY --from=builder /app/front/build ./assets/build
COPY --from=builder /app/front/css ./assets/css
COPY --from=builder /app/front/layouts ./assets/layouts
COPY --from=builder /app/front/ ./assets/layouts
COPY --from=builder /app/back/build /app/back/build
COPY --from=builder /app/back/db /app/back/db
COPY --from=builder /app/front/layouts /app/front/layouts
COPY --from=builder /app/front/assets /app/front/static/assets
COPY --from=builder /app/front/build /app/front/static/js
COPY --from=builder /app/front/css /app/front/static/css

EXPOSE 4242

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ log:
-not -name "*.db" \
-not -name "*.pdf" \
-not -name "*.ico" \
-not -name "package-lock.json" \
-print -exec echo "====> {} <====" \; -exec cat {} \; || true

.PHONY: build exec
38 changes: 37 additions & 1 deletion back/raw/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ app.register(fastifyView, {
}
});
app.register(fastifyStatic, {
root: path.join(__dirname, '../static'),
root: path.join(__dirname, '/app/front/static'),
prefix: '/static/'
});

Expand All @@ -51,6 +51,42 @@ async function startServer() {
}
}


/* --------------------------------- */
/* --------------API---------------- */
/* --------------------------------- */

// get
app.get('/users/:name', { preValidation: [app.authenticate] }, async (req: any, reply: any) => {
const { name } = req.params;
reply.send(`Profile for user: ${name}`);
});

// post
app.post("/login", async (req: any, reply: any) => {
const { username, password } = req.body;
// check with db
});
app.post("/register", async (req: any, reply: any) => {
const { username, password, email } = req.body;
// check with db
})

/* --------------------------------- */
/* --------------STATIC------------- */
/* --------------------------------- */

app.get('/partial/:page', async (req: any, reply: any) => {
const page = req.params.page;
const dataSample = { name: 'Jonas' };
return reply.view(`/app/front/layouts/pages/${page}.ejs`, dataSample);
});
app.get('/', async (req: any, reply: any) => {
return reply.view('pages/index.ejs', { name: 'Jonas' }, {
layout: '/app/front/layouts/basic.ejs'
});
});

startServer();

export { app };
5 changes: 0 additions & 5 deletions back/raw/routes/api/get/profile.ts

This file was deleted.

4 changes: 0 additions & 4 deletions back/raw/routes/api/get/user.ts

This file was deleted.

8 changes: 0 additions & 8 deletions back/raw/routes/api/post/login.ts

This file was deleted.

7 changes: 0 additions & 7 deletions back/raw/routes/api/post/register.ts

This file was deleted.

6 changes: 0 additions & 6 deletions back/raw/routes/static/page.ts

This file was deleted.

6 changes: 0 additions & 6 deletions back/raw/routes/static/root.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@fastify/formbody": "^7.0.0",
"@fastify/jwt": "^5.0.0",
"@fastify/static": "^6.0.0",
"@fastify/static": "^6.12.0",
"@fastify/view": "^7.0.0",
"@libsql/client": "^0.14.0",
"dotenv": "^16.0.0",
Expand Down

0 comments on commit 1405c98

Please sign in to comment.