Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aliartiza75/crud-for-iot-devices
This repository holds CRUD for IoT device using express framework.
https://github.com/aliartiza75/crud-for-iot-devices
ci docker nodejs travis-ci
Last synced: 26 days ago
JSON representation
This repository holds CRUD for IoT device using express framework.
- Host: GitHub
- URL: https://github.com/aliartiza75/crud-for-iot-devices
- Owner: aliartiza75
- Created: 2020-05-11T22:26:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-21T09:38:00.000Z (5 months ago)
- Last Synced: 2024-06-22T02:50:31.621Z (5 months ago)
- Topics: ci, docker, nodejs, travis-ci
- Language: JavaScript
- Homepage:
- Size: 556 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IoT Device CRUD
## Overview
This repository holds the manifests for the API of the IoT Device CRUD.
## Folder Structure
```bash
├── app.js # configuration for server
├── bin
│ └── server-start # server starting component
├── controllers # controllers handles the user requests
│ ├── AuthController.js
│ ├── DeviceController.js
│ └── FeedController.js
├── helpers # helpers are used in controllers
│ ├── apiResponse.js
│ └── utility.js
├── middlewares # intercepts the requests and validate jwt token
│ └── jwt.js
├── models # models
│ ├── DeviceModel.js
│ ├── FeedModel.js
│ └── UserModel.js
├── mqtt-python-client # mqtt clients
│ ├── configure_env.sh
│ ├── consumer.py
│ ├── producer.py
│ ├── README.md
│ └── requirements.txt
├── package.json # packages information
├── package-lock.json
├── postman-collection # collection of api endpoints
│ └── api.json
├── README.md # documentation
└── routes # api routes
├── api.js
├── auth.js
├── device.js
├── feed.js
└── index.js
```## Deployment Guidelines
Following the guidelines to start the server:
1. Install node and npm.
2. Install packages
```bash
npm install
```3. Convert the `.env.example` to `.env` file because server use the configuration provided in this file.
4. Start mongodb server as a docker container:
```bash
sudo docker run -d \
-e MONGO_INITDB_ROOT_USERNAME=mongoadmin \
-e MONGO_INITDB_ROOT_PASSWORD=secret \
-p 27017:27017 \
mongo
```5. Run the lint to check any linting issue:
```bash
npm run lint
```6. To start the server:
```bash
npm run dev
```7. Running as Docker container
1. Build its image:
```bash
sudo docker build -t crud-for-iot-devices:0.0.1 -f build/package/Dockerfile .
```2. Run it as a container:
```bash
sudo docker run -it -e MONGODB_URL=mongodb://127.0.0.1:27017/crud-for-iot-devices -e JWT_SECRET=abc1235 -e JWT_TIMEOUT_DURATION="2 hours" --net host crud-for-iot-devices:0.0.1
```8. Import the postman collection in the Postman application to use the api endpoints.