-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from quirrel-dev/human-friendly-index
Add index page
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FastifyPluginCallback } from "fastify"; | ||
|
||
const welcomePage = ` | ||
<h1> | ||
Welcome to the Quirrel API! | ||
</h1> | ||
<p> | ||
As an end-user, you're most likely looking for something else: | ||
</p> | ||
<ul> | ||
<li> | ||
<a href="https://quirrel.dev">Landing Page</a> | ||
</li> | ||
<li> | ||
<a href="https://docs.quirrel.dev">Documentation</a> | ||
</li> | ||
<li> | ||
<a href="https://github.com/quirrel-dev">Github</a> | ||
</li> | ||
</ul> | ||
<p> | ||
If you didn't get here by accident, but want to interface directly with the Quirrel API, | ||
take a look at the OpenAPI spec: | ||
</p> | ||
<ul> | ||
<li> | ||
<a href="/documentation">Swagger Docs</a> | ||
</li> | ||
<li> | ||
<a href="/documentation/docs.html">ReDocs</a> | ||
</li> | ||
</ul> | ||
`.trim(); | ||
|
||
const index: FastifyPluginCallback = (fastify, opts, done) => { | ||
fastify.get("/", (request, reply) => { | ||
reply.status(200).header("Content-Type", "text/html").send(welcomePage); | ||
}); | ||
done(); | ||
}; | ||
|
||
export default index; |