-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
35 lines (25 loc) · 773 Bytes
/
app.js
File metadata and controls
35 lines (25 loc) · 773 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
31
32
33
34
35
require('dotenv').config();
const express = require('express');
const expressLayouts = require('express-ejs-layouts');
const app = express();
const port = 5000 || process.env.PORT;
app.use(express.urlencoded({extended: true}));
app.use(express.json());
// static Files
app.use(express.static('public'));
// Templating Engine
app.use(expressLayouts);
app.set('layout', './layouts/main');
app.set('view engine', 'ejs');
// Routes
app.use('/', require('./views/server/routers/index'));
app.get('/', (req, res) =>{
const locals = {
title: 'NotesApp',
description: 'Free Notes App To Use',
}
res.render('index', locals);
});
app.listen(port, ()=> {
console.log(`Server running on port ${port}`);
});