-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
26 lines (23 loc) · 891 Bytes
/
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
const express = require('express');
const app = express();
const api = {
home: require('./api/home'),
userGenerator: require('./api/userGenerator'),
generatePassword: require('./api/generatePassword'),
ytDownload: require('./api/ytDownload')
};
app.set('trust proxy', true);
app.use(express.urlencoded({ extended: true }));
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
next();
});
app.get('/', api.home);
app.use('/api/userGenerator', api.userGenerator);
app.use('/api/generatePassword', api.generatePassword);
app.use('/api/download', api.ytDownload);
app.listen(3000, () => {
console.log('Server is running!');
});