dotenv
This commit is contained in:
parent
332981c8b0
commit
7ddc74428f
2 changed files with 16 additions and 3 deletions
19
server.js
19
server.js
|
|
@ -1,3 +1,6 @@
|
|||
//dotenv
|
||||
require('dotenv').config();
|
||||
|
||||
//nextcloud client
|
||||
const { Client, Server } = require("nextcloud-node-client");
|
||||
const server = new Server({
|
||||
|
|
@ -30,14 +33,24 @@ const fastify = require("fastify")({
|
|||
});
|
||||
fastify.register(require("fastify-static"), {
|
||||
root: path.join(__dirname, "public"),
|
||||
prefix: "/",
|
||||
prefix: "/"
|
||||
});
|
||||
fastify.register(require("fastify-formbody"));
|
||||
fastify.register(require("fastify-multipart"));
|
||||
fastify.register(require("point-of-view"), {
|
||||
engine: {
|
||||
handlebars: require("handlebars")
|
||||
}
|
||||
});
|
||||
|
||||
//'get'
|
||||
fastify.get("/", function (request, reply) {
|
||||
reply.sendFile("/index.html")
|
||||
// reply.view("/src/pages/parade.hbs", {});
|
||||
reply.view("/src/pages/entry.hbs", {});
|
||||
});
|
||||
|
||||
fastify.get("/entry*", function (request, reply) {
|
||||
reply.view("/src/pages/entry.hbs", {});
|
||||
});
|
||||
|
||||
//'post'
|
||||
|
|
@ -62,7 +75,7 @@ fastify.post("/", async function (request, reply) {
|
|||
console.log(data.fields.pixels);
|
||||
const image = await folder.createFile(data.fields.pixels.filename, await data.fields.pixels.toBuffer());
|
||||
|
||||
reply.sendFile("/index.html");
|
||||
reply.view("/src/pages/entry.hbs", {});
|
||||
});
|
||||
|
||||
//listen
|
||||
|
|
|
|||
Loading…
Reference in a new issue