-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.js
37 lines (28 loc) · 940 Bytes
/
server.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
36
37
const express = require("express");
const app = express();
const dotenv = require("dotenv");
const contestRouter = require("./routers/contest");
const hackathonRouter = require("./routers/hackathons");
const path = require('path');
dotenv.config({ path: "./config.env" });
const port = process.env.PORT || 3000;
require("./database/connection");
const staticPath = path.join(__dirname, "public");
app.use(express.static(staticPath));
app.use(express.json());
app.use(contestRouter);
app.use(hackathonRouter);
app.get("/", (req, res) => {
res.send("hi form the server");
});
// const createJson = (filePath, data) => {
// const dataJson = JSON.stringify(data, null, 2);
// fs.writeFile(`./json/${filePath}.json`, dataJson, (error) => {
// if (error) console.log(error);
// });
// console.log("ab done");
// };
app.listen(port, () => {
console.log(`Server started at ${port}`);
});
//validata things in user schemema