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.
|
|
|
import * as express from "express";
|
|
|
|
|
|
|
|
import * as schema from "@common/sprinklers/schema";
|
|
|
|
import {serialize} from "serializr";
|
|
|
|
import { ServerState } from "../state";
|
|
|
|
import logger from "./logger";
|
|
|
|
import serveApp from "./serveApp";
|
|
|
|
|
|
|
|
export function createApp(state: ServerState) {
|
|
|
|
const app = express();
|
|
|
|
|
|
|
|
app.use(logger);
|
|
|
|
|
|
|
|
app.get("/api/grinklers", (req, res) => {
|
|
|
|
const j = serialize(schema.sprinklersDevice, state.device);
|
|
|
|
res.send(j);
|
|
|
|
});
|
|
|
|
|
|
|
|
serveApp(app);
|
|
|
|
|
|
|
|
return app;
|
|
|
|
}
|