-
Notifications
You must be signed in to change notification settings - Fork 1
mm server
The mm-server code is here: source code. This Node application is going to interface with the Raspberry Pi. It can take a picture and copy the pictures to cloud-node. It also serves the Magic_mirror Angular4 app.
The Angular4 app is build with angular-cli ng build. This creates some minified compressed files in the dist directory. These need to be copied to the server at the root of the mm-server in the dist directory. Then, server.js will serve the Angular app with this code:
//Serve Angular App to Browser upon GET / request
main.use(express.static(path.join(__dirname, 'dist')));
The important API calls, or endpoints are as follows:
- POST '/picture'
This needs a body like this:
{
directory: path, // required
base_name: name, // name of picture
options: {
key: value
}
}
This will take a picture and save it in the folder path.
- DELETE '/picture/:folder'
where folder is the directory of pictures to delete. This will delete all the pictures in folder.
- PUT '/picture/:folder'
This will copy all the pictures in folder to the cloud node.