New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@lrpc/server

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lrpc/server

lRPC server package

latest
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

lRPC Server

Simple server aimed at making rapid back-end prototyping easier. Setup you functions on the server and call tem on the client as if it were the same codebase.

Installation

This is available as @lrpc/server on npm, so just install it as usual:

npm i @lrpc/server

# Or, with yarn

yarn add @lrpc/server

Usage

This package exports the createServer function, which creates an HTTP server using Node's internal http module.

createServer receives two parameters: and object with the functions you want to be able to call from the front-end (the handlers object), and an object with options.

import { createServer } from '@lrpc/server'

const server = createServer({
  greet: ({ name }: { name: string }) => ({
    ok: true,
    data: {
      greeting: `Hello, ${name}!`
    }
  })
})

server.listen(3000, () => { console.log('Listening on port 3000') })

Do note that your handlers must return an object containing, at least, the ok property, and that all data that you wish to send to the client must be inside data.

After that, your server is listening on port 3000, and is ready to be consumed by your client.

Contributing

There are no automated testes yet, so that's the main contribution I'm looking for, right now, but every contribution is welcome.

Just fork this repo, make sure ESlint and Commitlint are happy with your code and commits, and PR 😄

lRPC

lRPC stands for light Remote Procedure Calls. The idea for this came from a tweet.

Keywords

lrpc

FAQs

Package last updated on 21 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts