Skip to content

Commit

Permalink
🚧 init fastify
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelStark committed Mar 20, 2024
1 parent 8bc059a commit adee0a4
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
Vault is a cutting-edge tool that transforms how you manage your digital assets on Starknet. It lets you create custom accounts with unique rules and limits, ensuring your transactions are secure and tailored to your needs. Simple, flexible, and secure – Vault puts you in full control of your financial world.

## Vault service
## Vault backend

### Start

```bash
cd service
cd backend
bun i
bun start
```
Expand Down
File renamed without changes.
File renamed without changes.
Binary file added backend/bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions service/package.json → backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"fastify": "^4.26.2"
}
}
21 changes: 21 additions & 0 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Fastify from "fastify";
import { declareRoutes } from "./routes";

// Handle configuration
const PORT: number = parseInt(Bun.env.PORT || "8080");

// Create the Fastify instance
const fastify = Fastify({
logger: true,
});

// Declare routes
declareRoutes(fastify);

// Run the server
try {
await fastify.listen({ port: PORT });
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
14 changes: 14 additions & 0 deletions backend/src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { FastifyInstance, FastifyRequest, FastifyReply } from "fastify";

export function declareRoutes(fastify: FastifyInstance) {
fastify.get(
"/status",
async function handler(_request: FastifyRequest, _reply: FastifyReply) {
return handleGetStatus();
}
);
}

function handleGetStatus() {
return { status: "OK" };
}
File renamed without changes.
Binary file removed service/bun.lockb
Binary file not shown.
22 changes: 0 additions & 22 deletions service/src/index.ts

This file was deleted.

0 comments on commit adee0a4

Please sign in to comment.