Started adding mosquitto routes
This commit is contained in:
		
							parent
							
								
									cf880397f5
								
							
						
					
					
						commit
						5267f77e8a
					
				| @ -5,6 +5,7 @@ import { ErrorCode } from "@common/ErrorCode"; | |||||||
| import { authentication } from "@server/express/authentication"; | import { authentication } from "@server/express/authentication"; | ||||||
| import { ServerState } from "@server/state"; | import { ServerState } from "@server/state"; | ||||||
| import { devices } from "./devices"; | import { devices } from "./devices"; | ||||||
|  | import { mosquitto } from "./mosquitto"; | ||||||
| import { users } from "./users"; | import { users } from "./users"; | ||||||
| 
 | 
 | ||||||
| export default function createApi(state: ServerState) { | export default function createApi(state: ServerState) { | ||||||
| @ -12,6 +13,7 @@ export default function createApi(state: ServerState) { | |||||||
| 
 | 
 | ||||||
|     router.use("/devices", devices(state)); |     router.use("/devices", devices(state)); | ||||||
|     router.use("/users", users(state)); |     router.use("/users", users(state)); | ||||||
|  |     router.use("/mosquitto", mosquitto(state)); | ||||||
|     router.use("/token", authentication(state)); |     router.use("/token", authentication(state)); | ||||||
| 
 | 
 | ||||||
|     router.use("*", (req, res) => { |     router.use("*", (req, res) => { | ||||||
|  | |||||||
							
								
								
									
										21
									
								
								server/express/api/mosquitto.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								server/express/api/mosquitto.ts
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||||
|  | } | ||||||
| @ -12,6 +12,7 @@ export function createApp(state: ServerState) { | |||||||
| 
 | 
 | ||||||
|     app.use(requestLogger); |     app.use(requestLogger); | ||||||
|     app.use(bodyParser.json()); |     app.use(bodyParser.json()); | ||||||
|  |     app.use(bodyParser.urlencoded({ extended: true })); | ||||||
| 
 | 
 | ||||||
|     app.use("/api", createApi(state)); |     app.use("/api", createApi(state)); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user