-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (24 loc) · 768 Bytes
/
Copy pathindex.js
File metadata and controls
36 lines (24 loc) · 768 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
const express = require("express");
const connectDB = require("./db");
const cryptoRoutes = require("./routes/cryptoRoutes");
const startCronJob = require("./cronJob");
const serverless = require("serverless-http");
const app = express();
// const PORT = process.env.PORT || 3000;
// Basic route
app.get("/", function(req, res) {
res.send("Assignment Completed ✅");
})
// Connect to the database
connectDB();
// Start the cron job
startCronJob(); // This will now correctly start the cron job
// Middleware
app.use(express.json()); // To parse JSON bodies
// Routes
app.use("/api", cryptoRoutes);
// Start the server
// app.listen(PORT, () => {
// console.log(`Server is running on port ${PORT}`);
// });
module.exports.handler = serverless(app);