-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
40 lines (34 loc) · 971 Bytes
/
Copy pathserver.js
File metadata and controls
40 lines (34 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import fastify from "fastify";
import cors from "@fastify/cors";
import routes from "./src/routes/index.js";
import environment from "./src/config/envs.js";
// import { startJobs } from "./src/jobs/index.js";
import { clerkPlugin } from "@clerk/fastify";
// startJobs();
const app = fastify({
pluginTimeout: 60000,
bodyLimit: 10 * 1024 * 1024,
});
app.register(cors, {
origin: "*",
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
allowedHeaders: ["Content-Type", "Authorization", "X-Requested-With"],
credentials: true
});
app.register(clerkPlugin, {
secretKey: environment.clerkSecretKey,
publishableKey: environment.clerkPublishableKey,
});
app.register(routes);
app
.listen({
port: environment.port || 3000,
host: "0.0.0.0",
})
.then(() => {
console.log(`Server is running on port ${environment.port || 3000}`);
})
.catch((err) => {
console.error("Error starting server:", err);
process.exit(1);
});