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

remult

Package Overview
Dependencies
Maintainers
1
Versions
623
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remult

remult core lib

  • 0.3.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9K
decreased by-15.91%
Maintainers
1
Weekly downloads
 
Created
Source

Remult

GitHub license npm version

Remult is a lightweight web application framework for Full-Stack TypeScript.

Define Entity classes

import { Entity, EntityBase, Field } from 'remult';

@Entity('Products', {
    allowApiCrud: true
})
export class Product extends EntityBase {
  @Field()
  name: string = '';

  @Field()
  unitPrice: number = 0;
}

Find and manipulate data in front end code...

static increasePriceOfTofu(priceIncrease: number) {
  const product = await remult.repo(Product).findFirst(p => p.name.isEqualTo('Tofu'));

  product.unitPrice += priceIncrease;
  await product.save();
}

...exactly the same way as in back end code

@BackendMethod({ allowed: Allow.authenticated })
static increasePriceOfTofu(priceIncrease: number, remult?: Remult) {
  const product = await remult.repo(Product).findFirst(p => p.name.isEqualTo('Tofu'));

  product.unitPrice += priceIncrease;
  await product.save();
}

Secure the API with Fine-grained Authorization

@Entity<Article>('Articles', {
    allowApiRead: true,
    allowApiInsert: remult => remult.authenticated(),
    allowApiUpdate: (remult, article) => article.author.id == remult.user.id
})
export class Article extends EntityBase {
    @Field({ allowApiUpdate: false })
    slug: string;
    
    @Field({ allowApiUpdate: false })
    author: Profile;

    @Field()
    content: string;
}

Remult handles the REST:

  • Secured back-end API endpoints for Entities and back-end methods
  • CRUD API requests (front end) / database commands (back end)
  • Object-relational mapping
  • Validations
  • Caching
  • Authorization

Installation

npm i remult

API Setup using Express

import * as express from 'express';
import { initExpress } from 'remult/server';
import 'entities';

let app = express();
initExpress(app);
app.listen(3002, () => console.log("Server started"));

FAQs

Package last updated on 06 Oct 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

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