Merge pull request #9 from TxtDot/start-surfing
feat: start surfing page
This commit is contained in:
commit
c1dfd4d517
@ -28,9 +28,9 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "tsc",
|
||||
"dev": "ts-node src/app.ts",
|
||||
"start-ts": "ts-node src/app.ts",
|
||||
"start": "node dist/app.js",
|
||||
"watch": "tsc-watch --onSuccess \"node dist/app.js\""
|
||||
"dev": "tsc-watch --onSuccess \"node dist/app.js\""
|
||||
},
|
||||
"keywords": [],
|
||||
"authors": [
|
||||
|
@ -5,8 +5,9 @@ import Fastify from "fastify";
|
||||
import fastifyView from "@fastify/view";
|
||||
import ejs from "ejs";
|
||||
|
||||
import mainRoute from "./routes/main-route";
|
||||
import parseRoute from "./routes/parseRoute";
|
||||
import mainRoute from "./routes/main";
|
||||
import parseRoute from "./routes/parse";
|
||||
import startRoute from "./routes/start";
|
||||
|
||||
class App {
|
||||
config: IConfigService;
|
||||
@ -28,6 +29,7 @@ class App {
|
||||
|
||||
fastify.register(mainRoute);
|
||||
fastify.register(parseRoute);
|
||||
fastify.register(startRoute);
|
||||
|
||||
fastify.listen({ port: Number(this.config.get("PORT")) }, (err) => {
|
||||
err && console.log(err);
|
||||
|
7
src/routes/start.ts
Normal file
7
src/routes/start.ts
Normal 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");
|
||||
});
|
||||
}
|
35
templates/start.ejs
Normal file
35
templates/start.ejs
Normal file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<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>
|
Loading…
x
Reference in New Issue
Block a user