use express and ejs
This commit is contained in:
parent
0537c8129a
commit
251f4fa442
4 changed files with 33 additions and 0 deletions
8
src/routes/index.js
Normal file
8
src/routes/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const router = require('express').Router();
|
||||
|
||||
// Home Page
|
||||
router.get('/', (_, res) => {
|
||||
res.render('index');
|
||||
});
|
||||
|
||||
module.exports = router;
|
13
src/server.js
Normal file
13
src/server.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
|
||||
app.set('views', 'src/views');
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
app.use('/', require('./routes'));
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Constnium started on port ${port}.`);
|
||||
});
|
12
src/views/index.ejs
Normal file
12
src/views/index.ejs
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Constnium</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue