This commit is contained in:
52
server.js
52
server.js
@@ -1,35 +1,35 @@
|
||||
const fastify = require('fastify')();//{ logger: true });
|
||||
const path = require('path');
|
||||
const fastify = require("fastify")(); //{ logger: true });
|
||||
const path = require("path");
|
||||
|
||||
fastify.register(require('@fastify/static'), {
|
||||
root: path.join(__dirname, 'public'),
|
||||
prefix: '/public/',
|
||||
fastify.register(require("@fastify/static"), {
|
||||
root: path.join(__dirname, "public"),
|
||||
prefix: "/public/",
|
||||
});
|
||||
|
||||
fastify.register(require('@fastify/leveldb'), {
|
||||
name: 'db'
|
||||
}, err => {
|
||||
if (err) throw err
|
||||
});
|
||||
fastify.register(
|
||||
require("@fastify/leveldb"),
|
||||
{
|
||||
name: "db",
|
||||
},
|
||||
(err) => {
|
||||
if (err) throw err;
|
||||
},
|
||||
);
|
||||
|
||||
fastify.register(require("@fastify/view"), {
|
||||
engine: {
|
||||
pug: require("pug"),
|
||||
},
|
||||
engine: {
|
||||
pug: require("pug"),
|
||||
},
|
||||
});
|
||||
|
||||
fastify.register(require("./router/api"), { prefix: "/api" });
|
||||
|
||||
fastify.register(require('./router/api'), { prefix: '/api' });
|
||||
fastify.get("/", (req, reply) => reply.view("/template/home.pug"));
|
||||
fastify.get("/:id", (req, reply) => reply.view("/template/journey.pug"));
|
||||
fastify.get("/view/:id", (req, reply) => reply.view("/template/view.pug"));
|
||||
fastify.get("/short/:id", (req, reply) => reply.view("/template/short.pug"));
|
||||
|
||||
|
||||
fastify.get('/', (req, reply) => reply.view("/template/home.pug", ));
|
||||
fastify.get('/:id', (req, reply) => reply.view('/template/journey.pug'));
|
||||
fastify.get('/view/:id', (req, reply) => reply.view('/template/view.pug'));
|
||||
fastify.get('/short/:id', (req, reply) => reply.view('/template/short.pug'));
|
||||
|
||||
|
||||
fastify.listen({port:8080,host:'0.0.0.0'} ,(err,address) => {
|
||||
if (err) throw err;
|
||||
console.log("Listening on", address);
|
||||
|
||||
});
|
||||
fastify.listen({ port: 8080, host: "0.0.0.0" }, (err, address) => {
|
||||
if (err) throw err;
|
||||
console.log("Listening on", address);
|
||||
});
|
||||
|
Reference in New Issue
Block a user