This example uses Angular and RESTHeart WebsSocket API to create a basic chat application.
For more information refer to the Change Streams section in the RESTHeart documentation.
- Node.js 12+
- RESTHeart (6+)
- MongoDB (3.6+)
If you have docker installed, the provided docker-compose.yml file containes all that is needed.
You need node 12.x and npm 6.x to build and run this project.
- Install yarn
npm install --global yarn(yarn version >= 1.20.x but < than 2.x) - Clone this repository
git clone git@github.com:SoftInstigate/restheart-webchat.git - Run the following command to download and run the latest RESTHeart version
./bin/restart.sh -p restheart - Create message collection and define change stream stage
curl -u admin:secret -X PUT localhost:8080/messages -H "Content-Type: application/json" -d '{
"streams": [
{
"stages": [
{
"_$match": {
"_$or": [
{
"operationType": "insert"
}
]
}
}
],
"uri": "all"
}
]
}'- Run
yarnto install the required dependencies - Start the angular application with
yarn start --configuration=local