-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (35 loc) · 1.06 KB
/
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
36
37
38
39
40
41
42
const express = require("express");
const app = express();
const dotenv= require('dotenv')
var formidable = require("express-formidable");
const cors = require("cors");
const mongoose = require("mongoose");
dotenv.config();
app.use(cors());
app.use(formidable());
mongoose.connect(
process.env.DB_URL,
{ useNewUrlParser: true, useUnifiedTopology: true },
function (err, res) {
try {
console.log('Connected to Database');
} catch (err) {
throw err;
}
});
//import routes
const authRoute = require("./routes/auth");
const codeExe = require('./routes/codeExecutor/runCode');
const codeSaveRoute = require('./routes/saveCode');
const codeShowRoute=require('./routes/showCodes');
const codeUpdate = require('./routes/updateCode')
app.use(express.json());
// app.use(express.urlencoded({ extended: true }));
app.use("/api/user", authRoute);
app.use("/coding" ,codeExe);
app.use("/codesave",codeSaveRoute);
app.use("/seeCodes",codeShowRoute);
app.use("/update",codeUpdate);
app.listen(3000, () => {
console.log("Serever ready");
});