-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
37 lines (28 loc) · 906 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
31
32
33
34
35
36
37
// SIGNUP FORM/
// ├── app.js
// ├── routes.js
// ├── confirm.js
// ├── service.js
// ├── config.js
// ├── public/
// │ ├── index.html
// │ ├── styles.css
// │ └── script.js
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const config = require('./config');
const routes = require('./routes');
const app = express();
const port = process.env.PORT || config.port;
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'public')));
routes(app);
module.exports = app;
if (!module.parent) {
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});
}
// [HTML Form] -> [script.js] -> [POST /signup] -> [app.js] -> [routes.js] -> [confirm.js] -> [service.js] -> [MySQL Database]