-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
38 lines (27 loc) · 900 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
38
const dotenv = require("dotenv");
dotenv.config({path: "./config.env"});
const path = require("path");
const mongoose = require("mongoose");
const express = require("express");
const app = express();
const port = process.env.PORT || 3000;
require("../config/db");
const router = require("express").Router();
const hbs = require("hbs");
const ejs = require("ejs");
const static_path = path.join(__dirname, "../public")
//Routes
app.use(express.json());
// app.use(cookieParser());
app.use(express.urlencoded({extended:false}));
app.use(express.static(static_path));
app.set("view engine", "ejs");
// app.get("/", (req,res)=>{
// res.render("main")
// })
app.use('/api/files',require('../routes/files'));
app.use("/files",require("../routes/show"));
app.use("/files/download", require("../routes/download"))
app.listen(port, ()=>{
console.log(`Listening to port number ${port}`);
})