52 lines
809 B
JavaScript
52 lines
809 B
JavaScript
const find = require('local-devices')
|
|
const {getPrinters, print } = require("unix-print");
|
|
const ipp = require("ipp")
|
|
|
|
const express = require("express")
|
|
const app = express()
|
|
|
|
|
|
|
|
|
|
/*find().then(devices => {
|
|
console.log(devices)
|
|
})*/
|
|
|
|
|
|
|
|
|
|
//let printers = await getPrinters()
|
|
//console.log(printers)
|
|
|
|
app.get("/", async (req,res) => {
|
|
console.log(req)
|
|
|
|
|
|
res.send("ok")
|
|
//res.json(await getPrinters())
|
|
})
|
|
|
|
app.post("/printlabel", async (req,res) => {
|
|
res.json(await getPrinters())
|
|
})
|
|
|
|
app.get("/printdoc", async (req,res) => {
|
|
res.json(await getPrinters())
|
|
})
|
|
|
|
app.post("/printeralarm", (req,res) => {
|
|
console.log(req)
|
|
})
|
|
|
|
|
|
|
|
let options = [
|
|
"-o media=a4",
|
|
"-o sides=one-sided"
|
|
]
|
|
|
|
|
|
|
|
//print("Briefpapier.pdf","EPSON_ET_15000_Series",options).then(console.log)
|
|
|
|
app.listen(3001) |