change to ejs
This commit is contained in:
parent
9287290479
commit
e92c87c5da
11 changed files with 62 additions and 74 deletions
20
index.js
20
index.js
|
@ -2,28 +2,18 @@ import express from 'express';
|
|||
import multer from 'multer';
|
||||
import iterate from './routes.js';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import ejs from "ejs";
|
||||
|
||||
const port = process.env.PORT || 3000;
|
||||
|
||||
const header = `<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script src='/static/main.js'></script>
|
||||
<link rel='stylesheet' href='/static/main.css'>
|
||||
</head>
|
||||
<body>
|
||||
`
|
||||
|
||||
const footer = `
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
const app = express();
|
||||
const upload = multer({ dest: 'uploads/' });
|
||||
|
||||
app.use(cookieParser());
|
||||
app.use('/static', express.static('static'));
|
||||
app.engine('.ejs', ejs.__express);
|
||||
app.set('views', './views');
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.status(301).redirect('/client/main');
|
||||
|
@ -31,7 +21,7 @@ app.get('/', (req, res) => {
|
|||
|
||||
app.get('/client/:route', async (req, res) => {
|
||||
let dat = await iterate(req, res, 'client');
|
||||
res.send(header + dat + footer);
|
||||
//res.send(dat);
|
||||
})
|
||||
|
||||
app.get('/api/get/:route', async (req, res) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue