This is a sample backend app built on Node.js with Express.js middleware and the 100ms REST APIs. Exposed endpoints
- Create room
- Get auth token to join the room
- Get usage analytics
Deploy directly to Render using this button. But don't forget to add the environment variables specified in .env.example
to Render or the build will fail!
-
Clone the repo
git clone https://github.com/100mslive/100ms-sample-backend-nodejs.git
-
Install the dependencies
npm i
-
Rename the
.env.example
to.env
and add your credentialsAPP_ACCESS_KEY=<YOUR_APP_ACCESS_KEY> APP_SECRET=<YOUR_APP_SECRET>
-
Run the app
Running in dev mode (hot reload on file changes):
npm run start:dev
Running in production:
npm run start
Run with Docker Compose
docker compose up --build
This sample exposes the following endpoints
Endpoint | Method | Parameters | Description |
---|---|---|---|
/create-room |
POST | JSON body { |
Create a new room with room params (docs) |
/auth-token |
POST | JSON body { |
Generate an auth token for a peer to join a room (docs) |
/session-analytics-by-room |
GET | Query params ?room_id=633dxxxxxxxxxxxxxxx7d1d2 |
Usage analytics for a specific session (docs) |
/session-list-by-room |
GET | Query params ?room_id=633dxxxxxxxxxxxxxxx7d1d2 |
Get list of all sessions associated with a room (docs) |
Refer to the 100ms server-side docs to get started on your custom backend.