Initial commit

This commit is contained in:
Flummi
2018-02-16 14:25:46 +01:00
commit d0ae0041e8
21 changed files with 732 additions and 0 deletions

10
src/routes/index.mjs Normal file
View File

@ -0,0 +1,10 @@
import index from "./r/index";
import view from "./r/view";
import about from "./r/about";
export default {
index: index,
view: view,
about: about
};

8
src/routes/r/about.mjs Normal file
View File

@ -0,0 +1,8 @@
import express from "express";
const router = express.Router();
router.get("/", (req, res) => {
res.render("about");
});
export default router;

8
src/routes/r/index.mjs Normal file
View File

@ -0,0 +1,8 @@
import express from "express";
const router = express.Router();
router.get("/", (req, res) => {
res.render("index");
});
export default router;

33
src/routes/r/view.mjs Normal file
View File

@ -0,0 +1,33 @@
import express from "express";
const router = express.Router();
import highlight from "highlight.js";
console.log(highlight.highlightAuto("<?php\necho 'blah';\n?>"));
router.get("/", (req, res) => {
const data = {
pastes: [
{
title: "title 01",
paste: highlight.highlightAuto("<?php\necho 'blah';\n?>").value,
language: "PHP",
rows: "<?php\necho 'blah';\n?>".split(/\n/).length
},
{
title: "title 02",
paste: highlight.highlightAuto("blub").value,
language: "Plaintext",
rows: "blub".split(/\n/).length
},
{
title: "title 03",
paste: highlight.highlightAuto("muh").value,
language: "Plaintext",
rows: "muh".split(/\n/).length
}
]
};
res.render("view", data);
});
export default router;