tubular-nodejs

1.0.18 • Public • Published

codecov npm version

Tubular Node.js

⭐️ Please star this project if you find it useful!

Tubular Node.js provides an easy way to integrate Tubular Angular Components easily with any WebApi library.

Please visit the Tubular GitHub Page to learn how quickly you can start coding. See Related projects below to discover more Tubular libraries and backend solutions.

Installation

$ npm install tubular-nodejs --save

Sample

Use the following snippet if you're using express on your backend. That will handle a Tubular Grid request/response with a JSON data connector. You only need a JSON file like the one at raw file.

const express = require("express");
const app = express();
 
var tbNode = require("tubular-nodejs")("jsondata");
var data = require("/path/to/some/clients.json/file");
 
app.post("/clients", function(req, res) {
  tbNode.createGridResponse(req.body, data).then(function(response) {
    return res.json(response);
  });
});
 
app.listen(3000, function() {
  console.log("Example app listening on port 3000!");
});

Or you can just use the following snippet to use our Knex.js connector.

const express = require("express");
const app = express();
 
var tbNode = require("tubular-nodejs")("knexjs");
var knex = require("knex")({
  client: "mysql",
  connection: {
    host: "yourhost",
    user: "youruser",
    port: 3306,
    password: "",
    database: "yourdatabase"
  }
});
 
app.post("/clients", function(req, res) {
  let queryBuilder = knex
    .select("first_name", "last_name", "address_id")
    .from("clients");
  tbNode.createGridResponse(req.body, queryBuilder).then(function(response) {
    return res.json(response);
  });
});
 
app.listen(3000, function() {
  console.log("Example app listening on port 3000!");
});

Related Projects

Name Type Language/tech Description
Tubular React Common Library React React hooks to integrate with any Grid component.
Tubular React Library React Tubular-React is a DataGrid component using Material-UI
Tubular Common Library Javascript/Typescript Tubular Common provides TypeScript and Javascript models and data transformer to use any Tubular DataGrid component with an array of Javascript objects.
Tubular Dotnet Backend library C#/.NET Core Tubular provides .NET Framework and .NET Core Library to create REST service to use with Tubular Angular Components easily with any WebApi library (ASP.NET Web API for example).

Readme

Keywords

Package Sidebar

Install

npm i tubular-nodejs

Weekly Downloads

1

Version

1.0.18

License

MIT

Unpacked Size

262 kB

Total Files

17

Last publish

Collaborators

  • kadosh.ivan
  • unosquare