This repo contains 4 projects.
- A device simulator (/device)
- An mqtt broker (/server)
- An api enpoint (/api)
- A user interface
For connecting the broker, you need to send a post request to the api. For creating tokens. You can use this.
curl -d '{"email":"[email protected]","password":"1559"}' -H "Content-Type: application/json" -X POST http://localhost:8080/api/users
Returned email and password can be used as clientId and token. Of course this requires mongod active
If you just want to test it you can use hard coded token and deviceId's
- {'clientId': 'tester9000', 'token':'allow'},
- {'clientId': 'tester9001', 'token':'allow'},
- {'clientId': 'tester9002', 'token':'allow'},
- {'clientId': 'tester9003', 'token':'allow'}
node server # for nodemon
node device/client.js 4 localhost 1883 tester9000 allow
npm run dev # for nodemon
To see all api routes/urls check routes.js at api/routes.js
Frontend is currently not complete and stands for just to prove auth is working in the api. cookies hold as httpOnly and testing it at frontend is easier. Auth is currenly closed for curl to work on and can be opened by turning IS_AUTH_ON variable true at api/routes.js
For testing
- use Postman or equivalent for api
- for broker use client.js
- for MongoDB use compass
- for ui don't