# Framework Introduction
To simplify the integration to RELE.AI, RELE.AI (opens new window) provides a gRPC based framework to connect your internal services.
# Installation
Assuming you've already installed Node.js (opens new window), create a directory to hold your application, and make that your working directory.
mkdir myapp
cd myapp
Use the npm init
command to create a package.json
file for your application.
npm init
This command prompts you for a number of things, such as the name and version of your application. For now, you can simply hit RETURN to accept the defaults.
Now install the rb-node-sdk
in the myapp
directory and save it in the dependencies list. For example:
npm install @releai/rb-node-sdk --save
# Hello World
The following example starts a server on port 3000 for connections. The app responses with a protobuf.Struct (opens new window) message to RELE.AI.
// import the rb-server to the code
const { RBS } = require("@releai/rb-node-sdk")
const router = new RBS.Router()
// initiate the application
const rbs = new RBS({
appId: process.env.APP_ID,
appHash: process.env.APP_HASH
})
// register the hello_world operation
router.use("hello_world", (req, res) => {
res.send(200, { message: "Hello World!" })
})
// use exported router
rbs.use(router)
// initiate the listener
rbs.listen(3000)
NOTE
To get your APP_ID and APP_HASH please use rb app:tokens command.