Skip to content

arjunattam/100ms-sample-backend-nodejs

 
 

Repository files navigation

100ms-svg

Documentation Discord MIT License Register

100ms Sample Backend - NodeJs

About

This is a sample backend app built on Node.js with Express.js middleware using 100ms REST APIs to showcase some basic functionalities.

Getting Started

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!

Deploy to Render

Installation

  1. Clone the repo
git clone https://github.com/coder-with-a-bushido/100ms-sample-backend-nodejs.git
  1. Install the dependencies
npm i
  1. Rename the .env.example to .env and add your credentials
APP_ACCESS_KEY=<YOUR_APP_ACCESS_KEY>
APP_SECRET=<YOUR_APP_SECRET>
  1. Run the app

Running in dev mode (hot reload on file changes):

npm run start:dev

Running in production:

npm run start

Or

docker compose up --build

Usage

This sample backend app exposes the following endpoints:

Endpoint Method Request Description
/app-token POST JSON Body Params:
{
  "room_id": "632ecxxxxxxxxxxxxxxxxxxxxxx764",
  "role": "host",
  "user_id":"test_user"
}
Generate an auth token for a peer to join a room.
Please refer to https://www.100ms.live/docs/server-side/v2/introduction/authentication-and-tokens
/create-room POST JSON Body Params:
{
  "random_room": true
}
Or
{
  "random_room": false,
  "name": "new-room-{{$timestamp}}",
  "description": "This is a sample description for the room",
  "template_id": "6318xxxxxxxxxxxxxxxxxc60",
  "region": "in"
}
Create a new room, either randomly or with the requested configuration.
Please refer to https://www.100ms.live/docs/server-side/v2/Rooms/create-via-api
/session-analytics GET Query Params:
{
  "session_id": 633dxxxxxxxxxxxxxxx7d1d2
}
Get Session Analytics for a specific session (like attendance).
Please refer to https://www.100ms.live/docs/server-side/v2/Sessions/example-build-attendance

100ms SDK Documentation

Refer the 100ms SDK Server-Side guide to get started on building your custom backend with 100ms APIs.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.7%
  • Dockerfile 1.6%
  • Shell 0.7%