22 lines
513 B
JavaScript
22 lines
513 B
JavaScript
|
const express = require('express');
|
||
|
const path = require('path')
|
||
|
|
||
|
const app = express();
|
||
|
|
||
|
const port = parseInt(process.env.PORT) || process.argv[3] || 8080;
|
||
|
|
||
|
app.use(express.static(path.join(__dirname, 'public')))
|
||
|
.set('views', path.join(__dirname, 'views'))
|
||
|
.set('view engine', 'ejs');
|
||
|
|
||
|
app.get('/', (req, res) => {
|
||
|
res.render('index');
|
||
|
});
|
||
|
|
||
|
app.get('/api', (req, res) => {
|
||
|
res.json({"msg": "Hello FreshBrewed."});
|
||
|
});
|
||
|
|
||
|
app.listen(port, () => {
|
||
|
console.log(`Listening on http://localhost:${port}`);
|
||
|
})
|