Browse Source

Started adding mosquitto routes

update-deps
Alex Mikhalev 6 years ago
parent
commit
5267f77e8a
  1. 2
      server/express/api/index.ts
  2. 21
      server/express/api/mosquitto.ts
  3. 1
      server/express/index.ts

2
server/express/api/index.ts

@ -5,6 +5,7 @@ import { ErrorCode } from "@common/ErrorCode"; @@ -5,6 +5,7 @@ import { ErrorCode } from "@common/ErrorCode";
import { authentication } from "@server/express/authentication";
import { ServerState } from "@server/state";
import { devices } from "./devices";
import { mosquitto } from "./mosquitto";
import { users } from "./users";
export default function createApi(state: ServerState) {
@ -12,6 +13,7 @@ export default function createApi(state: ServerState) { @@ -12,6 +13,7 @@ export default function createApi(state: ServerState) {
router.use("/devices", devices(state));
router.use("/users", users(state));
router.use("/mosquitto", mosquitto(state));
router.use("/token", authentication(state));
router.use("*", (req, res) => {

21
server/express/api/mosquitto.ts

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
import PromiseRouter from "express-promise-router";
import { ServerState } from "@server/state";
export function mosquitto(state: ServerState) {
const router = PromiseRouter();
router.post("/auth", async (req, res) => {
res.status(200).send();
});
router.post("/superuser", async (req, res) => {
res.status(200).send();
});
router.post("/acl", async (req, res) => {
res.status(200).send();
});
return router;
}

1
server/express/index.ts

@ -12,6 +12,7 @@ export function createApp(state: ServerState) { @@ -12,6 +12,7 @@ export function createApp(state: ServerState) {
app.use(requestLogger);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use("/api", createApi(state));

Loading…
Cancel
Save