Home

Awesome

codecov npm version

Tubular Node.js

:star: 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

NameTypeLanguage/techDescription
Tubular React CommonLibraryReactReact hooks to integrate with any Grid component.
Tubular ReactLibraryReactTubular-React is a DataGrid component using Material-UI
Tubular CommonLibraryJavascript/TypescriptTubular Common provides TypeScript and Javascript models and data transformer to use any Tubular DataGrid component with an array of Javascript objects.
Tubular DotnetBackend libraryC#/.NET CoreTubular 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).