Skip to content

Commit

Permalink
added procfile
Browse files Browse the repository at this point in the history
  • Loading branch information
UKnowWhoIm committed May 21, 2021
1 parent 3911ff1 commit 7d4459c
Show file tree
Hide file tree
Showing 4 changed files with 925 additions and 1 deletion.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm start
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import express from 'express';
import mongoose from "mongoose";
import { job } from "./cron.js";
import cron from "node-cron";
import { DEBUG, mongoURL } from "./config.js";

const app = express();
const port = process.env.PORT ?? "3000";

async function start() {
try {
await mongoose.connect(mongoURL, {
Expand All @@ -19,6 +23,14 @@ start();
if(DEBUG)
console.log("DEBUG Mode");

app.get('/', (_, res) => {
res.send('Hello World!')
});

app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
});

// In debug mode send notif every minute
cron.schedule(DEBUG ? "* * * * *" : "0 * * * *", () => {
console.log("Starting notifications");
Expand Down
Loading

0 comments on commit 7d4459c

Please sign in to comment.