-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (25 loc) · 998 Bytes
/
index.js
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
import express from "express";
import bodyParser from "body-parser";
import * as dotenv from "dotenv";
import sendToNotion from "./notion/toNotion.js";
// ___________________________________________________________________________________
const app = express();
dotenv.config();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
// ___________________________________________________________________________________
//
app.get("/", function (req, res) {
res.send("Executed sucessfully!");
});
//
app.post("/notion", function (req, res) {
const title = req.body.title;
const summary = req.body.summary;
sendToNotion(title, summary);
return res.send("Executed sucessfully!");
});
// ___________________________________________________________________________________
app.listen(process.env.PORT);
console.log("\nServer running at port: http://localhost:6969\n");
// ___________________________________________________________________________________