tuos-api

1.0.10 • Public • Published

tuos-api

Tuos API

Installation

# NPM
npm i tuos-api

Usage

server.js

require("dotenv").config();
const fastify = require("fastify")({ logger: true });

fastify.register(require("tuos-api").plugin, {
	jwt_token: "SECRET_TOKEN",
	mongo_host: "mongodb://localhost/test-01",
});

const start = async () => {
	const PORT = 8080;
	const HOST = "0.0.0.0";
	await fastify.ready();
	await fastify
		.listen(PORT, HOST)
		.then((addr) => {
			console.log(`[SYSTEM] Server listening on ${addr}`);
		})
		.catch((err) => {
			fastify.log.error(err);
			console.log("[SYSTEM] Failed to start server! exiting...");
			process.exit(1);
		});
};

start();

Run server.js with node

node server

or with nodemon

nodemon server

Dependents (0)

Package Sidebar

Install

npm i tuos-api

Weekly Downloads

1

Version

1.0.10

License

Apache-2.0

Unpacked Size

13.5 kB

Total Files

5

Last publish

Collaborators

  • lighty262