-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
56 lines (44 loc) · 1.4 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
CS340 Project Group 146
Arberim Ame
Jenny Zhong
app.js
This file is the main entry point for the application.
It sets up the server and routes.
Citation:
DATE: 02/28/2024
This code is adopted from the CS340 Node.js starter guide.
URL: https://github.com/osu-cs340-ecampus/nodejs-starter-app
*/
// SETUP
var express = require('express');
var app = express();
PORT = 3247;
var db = require('./database/db-connector');
const { engine } = require('express-handlebars');
var exphbs = require('express-handlebars');
app.engine('.hbs', engine({ extname: '.hbs' }));
app.set('view engine', '.hbs');
app.use(express.urlencoded({ extended: true }))
app.use(express.json())
app.use(express.static('public'));
// ROUTES
const customersRoute = require('./routes/customers');
const ordersRoute = require('./routes/orders');
const recordsRoute = require('./routes/records');
const genresRoute = require('./routes/genres');
const recordordersRoute = require('./routes/recordorders');
const genrerecordsRoute = require('./routes/genrerecords');
app.use('/', customersRoute);
app.use('/', ordersRoute);
app.use('/', recordsRoute);
app.use('/', genresRoute);
app.use('/', recordordersRoute);
app.use('/', genrerecordsRoute);
app.get('/', function(req, res) {
res.render('index');
});
// LISTENER
app.listen(PORT, function() {
console.log('Listening on port ' + PORT + '; press Ctrl-C to terminate.');
});