-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
30 lines (20 loc) · 726 Bytes
/
Copy pathserver.js
File metadata and controls
30 lines (20 loc) · 726 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
25
26
27
28
29
30
// Required Dependacies. //
const fs = require('fs');
const express = require('express');
const path = require('path'); // Maybe... Ref. https://nodejs.dev/learn/the-nodejs-path-module //
// YOU NEED THIS TO SETUP THE EXPRESS APPLICATION. //
const app = express();
// PORT Setup. //
const PORT = process.env.PORT || 8081;
// EXPRESS STATIC PATH. //
app.use(express.static('public'));
// YOU NEED A WAY TO PARSE THE DATA. //
app.use(express.json());
app.use(express.urlencoded({extended: true}));
// Configured Routes //
require('./routes/apiRoute.js')(app);
require('./routes/htmlRoute')(app);
// START THE SERVER! //
app.listen(PORT, function() {
console.log('Your application is listening on PORT ' + PORT);
})