-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
24 lines (17 loc) · 699 Bytes
/
server.js
File metadata and controls
24 lines (17 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const express = require('express');
const app = express();
require('dotenv').config();
const routes = require('./secrets');
const PORT = process.env.SECRETS_PORT ? process.env.SECRETS_PORT : 9000;
const SECRETS_API_TOKEN = process.env.SECRETS_API_TOKEN ? process.env.SECRETS_API_TOKEN : require('crypto').randomBytes(48, function(err, buffer) {
let token = buffer.toString('hex');
console.log("======> Your secret token is : "+token );
process.env['SECRETS_API_TOKEN'] = token;
return token;
});
app.use(express.json());
app.use('/', routes);
app.listen(PORT, () => {
console.log("Mini Cloud Config is ready and listening at " + PORT)
})
app.use(express.static('pages'));