0.2.5 ā€¢ Published 3 years ago

tyfon-server v0.2.5

Weekly downloads
17
License
MIT
Repository
github
Last release
3 years ago

tyfon-server

Create express routers or apps that expose your functions as endpoints automatically.

import { server } from 'tyfon-server';

server({
  getMessage: async () => 'Hellow World!'
}).listen(8000);

// šŸš€ check it out on `localhost:8000/message`

šŸ‘‰ Learn more about TyFON

Installation

npm i tyfon-server

Usage

šŸ‘‰ Create a server:

import { server } from 'tyfon-server';

server({
  getMessage: async (name: string) => `Hellow ${name}!`
}).listen(8000);

// šŸš€ check it out on `localhost:8000/message?0=World`

šŸ‘‰ Create a router:

import express from 'express';
import cors from 'cors';
import { json } from 'body-parser';
import { router } from 'tyfon-server';

const app = express();
app.use(cors());
app.use(json());
app.use('/funcs', router({
  getMessage: async (user: { name: string }) => `Hellow ${user.name}!`
});

app.listen(8000);

// šŸš€ check it out on `localhost:8000/funcs/message?0={"name":"Jack"}`

tyfon-conventions is used to map function names to URL endpoints and Http methods. You can also provide SDK metadata that allows TyFON CLI to automatically build SDKs for your functions.

šŸ‘‰ Read this post for more information.

0.2.1

3 years ago

0.2.0

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago