-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
29 lines (23 loc) · 915 Bytes
/
server.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
const express = require("express");
const expressAsyncHandler = require('express-async-handler')
const bodyParser = require("body-parser");
const app = express();
//-------------------------------------------------------------------------
// parse permintaan jenis konten - application / json
app.use(bodyParser.json());
// parse permintaan jenis konten - application / x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static('public'))
//-------------------------------------------------------------------------
// route awalan yaitu index
// app.use('view engine', 'html');
app.get("/", (req, res) => {
res.render('./public/index.html');
});
// tambahan produksi routes
require("./app/routes/produksiRoutes")(app);
// port untuk server lokal
const PORT = process.env.PORT || 3200;
app.listen(PORT, () => {
console.log(`Server berjalan pada Port : ${PORT}.`);
});