galerie/srv/src/index.ts

30 lines
1.1 KiB
TypeScript

/*
Copyright 2022 0xf8
This file is part of galerie
Galerie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Galerie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Galerie. If not, see <https://www.gnu.org/licenses/>.
*/
import express from "express";
import bodyparser from "body-parser";
import sync from "./sync";
const app = express();
const port = 8856;
app.use(bodyparser.text())
app.get("/sync", sync);
app.post("/sync", sync);
app.use("/img/", express.static("public/"));
app.use("/", express.static("web/"));
app.listen(port, (err?: any) => {
if (err) {
return console.error(err);
}
return console.log(`Listening @ http://localhost:${port}`);
});