Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rster/database

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rster/database

RSTER is a toolset for REST Api creation

  • 0.1.0
  • beta
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Github Shield NPM Shield Documentation TypeDoc

Build Status Contributors Forks Stargazers Issues BSD-3-Clause NPM Downloads Coverage


Logo

rster

build design your backend
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Tutorial Intro
    1. Prerequisites
    2. What you'll need
    3. Installation
    4. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact

About The Project

Rster is built to simplify creation of restful backend apis. It is a framework that allows you to build your api in a modular way. It's core framework works quite similar to express, however we provide a few tools like @rster/builder, @rster/database to drastically simplify the creation of your api and directly integrate your database. These tools are especially powerful when combined with typescript as all typings are generated automatically. Also with @rster/generator you can generate a typescript client directly from your server-side api definition which saves you a lot of time and nerves.

NOTE: This project is still in early development and features are added frequently. If you have any suggestions or ideas feel free to open an issue or pull request. @rster/generator and @rster/database are not available via npm yet. They need to be built from source and are not yet documented or tested enough to be used in production. Feel free to try them out and give feedback. Please have some patience, they take a lot of work to build and test. They will be released soon. Thanks!

(back to top)

Built With

typescript nodejs npm eslint jest express

(back to top)

Tutorial Intro

Hello and welcome to the rster project. Rster is the easiest way to build your backend api in nodejs. It is a framework that allows you to build your api in a modular way. Just define your library then use your functions to access and modify your data. Or directly add it to the express app using express.use(). It is up to you. You can even generate a typescript client directly from your server-side api definition!

Let's learn rster rster in less than 5 minutes.

Prerequisites

We recommend you to have basic knowledge of the following tools before starting:

  • node.js: a JavaScript runtime built on Chrome's V8 JavaScript engine.
  • npm: a package manager for the JavaScript programming language.

What you'll need

  • Node.js version 14 or higher (which comes with npm) installed on your computer.
    • When installing Node.js, you are recommended to check all checkboxes related to dependencies.
    • On some systems you might need to install npm separately.

Installation

Install rster package locally

npm install rster

alternatively you can use yarn

yarn add rster

Additional Dependencies

Rster packages a few core dependencies that will help you getting started. However we have a few more dependencies that you might want to install. You definitly want to install a worker implementation. A worker implementation is a package that allows you to run your rster application on a webserver so you can access your api from the internet. We recommend using @rster/worker-express as it is the easiest to get started with.

find more worker implementations here

npm install @rster/worker-express

alternatively you can use yarn

yarn add @rster/worker-express

Getting Started

Lets use express in our application

Firstly we want to import the rest function from rster as well as our worker's implementation. (we'll use express in this example)

import { rest } from "rster";
import "@rster/worker-express";

The worker will extend the prototype of our rest api object. Types are automatically extended as well.

Next we can define the pattern of our api. We will create a simple api that returns a string when we call the /hello endpoint.

const api = rest(function () {
  this.get("/hello", function () {
    this.action(function (req, res) {
      res.status(200).json({ message: "Hello World!" }).end();
    });
  });
});

NOTE: It is important to use the function() syntax instead of the arrow function () => {} as the this keyword is not bound to the arrow function.

Now we can create a webserver using express and pass our api it using the use function and the express worker.

import express from "express";

const app = express();

app.use(api.express());

For more examples, please refer to the Documentation

(back to top)

Roadmap

  • Rster base framework
  • Rster advanced framework
    • Rster builder (in development, heavily worked on right now, will be released soon)
    • Rster database (in development)
    • Rster generator (in development)

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the BSD-3-Clause License. See LICENSE for more information.

(back to top)

Contact

Nicolas Schmidt

twitter github

Project Link: https://github.com/nsc-de/rster

GitHub

(back to top)

FAQs

Package last updated on 27 Sep 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc