Bapi Fastify Support v0.0.2 Documentation
Table of Contents
Installation
Install via NPM:
npm i @bapi.js/fastify
Server
Function that handles and creates Fastify server.
Argument | Type | Description | Required |
---|---|---|---|
Client | Client | Client to build server for | Yes |
Options | object | Fastify server options | No |
@Returns fastify(...) (see documentation)
Example
// imports...
const client = bapi();
const server = Server(client);
client.get("test", ctx => {
return { status: "success" };
});
server.get("/", (req, rep) => {
rep.send({ message: 'Hello, World!' });
});
server.listen(8080, (err) => {
if(err) throw err;
console.log('Server Running!');
});