Node-server for unitstock app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
564 B

  1. var express = require("express");
  2. var router = express.Router();
  3. var sqliteModel = require("../model/sqliteModel.js");
  4. router.get("/getSqliteDb/:company/:cabangId", async function (req, res, next) {
  5. var company = req.params.company;
  6. var cabangId = req.params.cabangId;
  7. var sqliteDb = await sqliteModel.CreateDataCollection(company, cabangId);
  8. if (sqliteDb["STATUS"] == 0) {
  9. return res.status(500).send(sqliteDb["DATA"]);
  10. } else {
  11. var dbPath = sqliteDb["DATA"];
  12. res.download(dbPath);
  13. }
  14. });
  15. module.exports = router;