https://github.com/azasypkin/frunze-api
Rust API server for Frunze Web IDE https://github.com/azasypkin/frunze.
https://github.com/azasypkin/frunze-api
iot-platform mongodb rest-api rust rust-lang
Last synced: 2 months ago
JSON representation
Rust API server for Frunze Web IDE https://github.com/azasypkin/frunze.
- Host: GitHub
- URL: https://github.com/azasypkin/frunze-api
- Owner: azasypkin
- License: mit
- Created: 2017-06-25T15:14:32.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-07T19:34:59.000Z (over 7 years ago)
- Last Synced: 2025-06-13T14:11:32.705Z (about 1 year ago)
- Topics: iot-platform, mongodb, rest-api, rust, rust-lang
- Language: Rust
- Size: 311 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Frunze API Server
[](https://travis-ci.org/azasypkin/frunze-api)
[](https://raw.githubusercontent.com/azasypkin/frunze-api/master/LICENSE)
Rust API server supporting [__Frunze Web IDE__](https://github.com/azasypkin/frunze).
## Development
__Frunze API Server__ is API server written in Rust that relies on MongoDB database.
### Database
To setup database please follow the instructions from [Frunze repository](https://github.com/azasypkin/frunze/blob/master/README.md#database).
### Bill of Materials API
To estimate the price of your project, we should gather real-time offers for every project hardware component from the
distributors (DigiKey, Mouser etc.) and we leverage [Octopart](https://octopart.com/) for that. That means you should
supply `--bom-api-key xxxxxx` command line argument with the proper [Octopart API Key](https://octopart.com/api/home).
### Schematic Export API
To locally deploy Schematic Export API please follow the instructions from [Frunze repository](https://github.com/azasypkin/frunze/blob/master/README.md#frunze).
### Run Server
Run development API server with (localhost:8009 by default):
```bash
$ cargo run
```
or if you'd like to use custom IP address or/and port (don't forget to re-configure client part as well):
```bash
$ cargo run -- --ip 127.0.0.2 --port 8008
```
with Export API key:
```bash
$ RUST_LOG=frunze_api cargo run -- --bom-api-key xxxxxxxx
```
For custom MongoDB instance use the following parameters:
```bash
$ cargo run -- ... --db-ip 127.0.0.3 --db-port 27018 --db-name my-own-db-name
```
There is also option to run the API server in a dedicated Docker container if you just want to check it out:
```bash
$ docker build -t frunze-api:dev .
$ docker run -d --name frunze-api -p 8009:8009 frunze-api:dev
```
### Build Server
Run `cargo build`. The build artifacts will be stored in the `target/` directory. Use `--release` flag
for a production build.
### Run unit tests
Server part unit tests rely on `stainless` crate and hence require Rust Nightly (the server itself works fine with Rust Stable). It's recommended
to use [`rustup`](https://rustup.rs) to deal with several Rust versions simultaneously. Let's say you use `rustup`, then to run unit tests
just run:
```bash
$ cargo +nightly test
```
### Run Rust linter and source code formatter
To run [Clippy](https://github.com/Manishearth/rust-clippy) checks:
```bash
$ cargo +nightly clippy
```
To format project with [RustFmt](https://github.com/rust-lang-nursery/rustfmt):
```bash
$ cargo +nightly fmt
```