Node.js

Create a Simple Express Server

Now, let's write the basic structure of our server. Open your server.js file and add the following code:

const express = require('express');
const dotenv = require('dotenv');

require("dotenv").config();

const app = express();

// Middleware setup
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cors());

const PORT = process.env.PORT || 4000;

// Sample endpoint
app.get('/', (req, res) => {
  res.send('Vonage Verify backend is running.');
});

// Start server
app.listen(PORT, () => {
  console.log(`Server is listening on port ${PORT}`);
});
  • We import Express and CORS for building the API.
  • We use express.json() and express.urlencoded() to parse incoming request bodies.
  • The cors() middleware allows requests from any origin.
  • We add a simple endpoint (/) that returns a message to confirm that the server is running.

Time to test our backend implementation. Run the server:

node server.js

And visit http://localhost:3000 in your browser. You should see:

Vonage Verify Backend is running

If you see this, congratulantions! your server is working correctly!

Getting Started with Silent Authentication

Silent Authentication takes quite a bit to understand. This tutorial shows you how to build an integration from scratch with Nodejs and Kotlin

以下の言語で利用可能:
Node.js
手順
1
Introduction
2
Before you start
3
Initialize the Project
4
Create a Simple Express Server
5
Setting up Vonage credentials
6
Add the Vonage Verify API
7
Testing the Backend
8
Create New Android Project
9
Set up app Android dependencies
10
Set up import and constants
11
Create Mobile UI
12
Networking to Backend
13
Testing Full Flow