/apidemo

This is a website for learning and demonstrating the lockval API

Primary LanguageTypeScriptMIT LicenseMIT

lockval/apidemo

This is the source code of https://apidemo.lockval.com

You can download and edit client.yaml and public/server/...

to generate your own server

1. Use Dev Container to open project in vscode

You may need these tools:

  • Visual Studio Code
  • Docker Desktop

Follow the steps to open the project:

  1. Open this project in vscode
  2. Click Open a Remote Window in the lower left corner
  3. Click "Reopen in Container"

If successful you will see Dev Container: apidemo in the lower left corner

Build a Linux development environment (not recommended)

2. Client Project Setup

in vscode TERMINAL:

npm install

3. Server Start

in vscode TERMINAL:

./serverStart.sh

4. Build ServerScript And Upload (Choose a language you want to use)

  • JS

    edit public/server/javascript/... and run:

    npm run serverJsBuildAndUpload
  • Lua

    edit public/server/lua/... and run:

    npm run serverLuaBuildAndUpload
  • Starlark (Starlark is a dialect of Python)

    edit public/server/starlark/... and run:

    npm run serverStarBuildAndUpload
  • Go

    edit public/server/go/... and run:

    npm run serverGoBuildAndUpload

4. Build Client And Preview

in vscode TERMINAL:

npm run clientBuildAndPreview

Click "Open in Browser" to open website

Client Code:

  • public/client/paclient.ts (core code)
  • public/client/player.ts (User Event and Module Data Definition Code, Generated by client.yaml)

Customize your own Authentication server

You can learn how to develop a login(Service AuthN) and a guest(3rd Platform AuthN) here

Define variables for your Production environment:

(If you just want to preview locally, you can ignore this configuration)

export lockvalUpdatefileDomain=127.0.0.1:8080
export lockvalUpdatefilePassword=123456
export lockvalGwAddrs=http://127.0.0.1:59501,http://127.0.0.1:59502