feat: start surfing page

This commit is contained in:
Artemy 2023-08-14 18:08:26 +03:00
parent d9fd968792
commit c614e51708
4 changed files with 49 additions and 1 deletions

View File

@ -6,7 +6,8 @@ import fastifyView from "@fastify/view";
import ejs from "ejs"; import ejs from "ejs";
import mainRoute from "./routes/main-route"; import mainRoute from "./routes/main-route";
import parseRoute from "./routes/parseRoute"; import parseRoute from "./routes/parse-route";
import startRoute from "./routes/start-route";
class App { class App {
config: IConfigService; config: IConfigService;
@ -28,6 +29,7 @@ class App {
fastify.register(mainRoute); fastify.register(mainRoute);
fastify.register(parseRoute); fastify.register(parseRoute);
fastify.register(startRoute);
fastify.listen({ port: Number(this.config.get("PORT")) }, (err) => { fastify.listen({ port: Number(this.config.get("PORT")) }, (err) => {
err && console.log(err); err && console.log(err);

View File

@ -0,0 +1,7 @@
import { FastifyInstance } from "fastify";
export default async function parseRoute(fastify: FastifyInstance) {
fastify.get("/start", async (_, reply) => {
return reply.view("/templates/start.ejs");
});
}

39
templates/start.ejs Normal file
View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js"> <!--<![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>TXTDot starting page</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<form action="/">
<label for="url">URL</label>
<input type="text" name="url">
<p>
<label for="engine">Engine</label>
<select name="engine">
<option selected value>Standard</option>
<option value="readability">Readability</option>
</select>
</p>
<p>
<label for="format">Format</label>
<select name="format">
<option selected value>Standard</option>
<option value="html">HTML</option>
<option value="text">Text</option>
</select>
</p>
<input type="submit">
</form>
</body>
</html>