Initial commit
This commit is contained in:
10
src/routes/index.mjs
Normal file
10
src/routes/index.mjs
Normal 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
8
src/routes/r/about.mjs
Normal 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
8
src/routes/r/index.mjs
Normal 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
33
src/routes/r/view.mjs
Normal 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;
|
Reference in New Issue
Block a user