bodyparser
This commit is contained in:
parent
7405165c98
commit
22211749dd
|
@ -9,6 +9,7 @@
|
|||
"author": "Flummi",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.18.2",
|
||||
"express": "^4.16.2",
|
||||
"express-handlebars": "^3.0.0",
|
||||
"highlight.js": "^9.12.0",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import cfg from "../cfg/config";
|
||||
import express from "express";
|
||||
import exphbs from "express-handlebars";
|
||||
import bodyParser from "body-parser";
|
||||
import router from "./routes";
|
||||
|
||||
const hbs = exphbs.create({
|
||||
|
@ -11,6 +12,9 @@ const hbs = exphbs.create({
|
|||
for(var i = 0; i < n; ++i)
|
||||
rows.push(block.fn(i+1));
|
||||
return rows.join("<br />");
|
||||
},
|
||||
stringify: (obj) => {
|
||||
return JSON.stringify(obj);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -20,15 +24,14 @@ app
|
|||
.engine("handlebars", hbs.engine)
|
||||
.set("view engine", "handlebars")
|
||||
.use(express.static("public", cfg.websrv.static_options))
|
||||
.use(bodyParser.json())
|
||||
.use(bodyParser.urlencoded({ extended: true }))
|
||||
|
||||
.use("/", router.index)
|
||||
.use("/v", router.view)
|
||||
.use("/a", router.about)
|
||||
.use("/test", router.newpaste)
|
||||
|
||||
.get("/:uuid", (req, res) => {
|
||||
res.send(req.params.uuid);
|
||||
})
|
||||
.get("/:uuid", (req, res) => res.redirect(`/v/${req.params.uuid}/`))
|
||||
|
||||
.listen(cfg.websrv.port, () => {
|
||||
console.log(`fpaste listening on port ${cfg.websrv.port}`);
|
||||
|
|
Loading…
Reference in New Issue
Block a user