-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
30 lines (23 loc) · 726 Bytes
/
app.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
// apidoc -i . -o docs -f *.js
require("dotenv").config();
const express = require("express");
const app = express();
const cors= require('cors');
const socket = require('./helpers/web_ssh')
// for verbose logging
app.use(require("morgan")("dev"));
// to handle post request
const bp = require("body-parser");
app.use(bp.json());
app.use(cors());
app.use(bp.urlencoded({extended:false}));
// connect to mongoDB
app.use('/',require('./routes/docker'))
app.use('/sshclient',require('./routes/sshclient'))
app.use((err,req,res,next)=>{
console.error(err);
res.send({err:err.message});
});
const server = app.listen(process.env.PORT || 3000, ()=>console.log("Listening..."));
socket(server)
module.exports=app