npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ninjagl/api

v1.0.4

Published

R3F-WEBGL FastGameApi

Downloads

30

Readme

NinjaApi

NinjaGLで作成したコンテンツのデータ連携 ※エンドポイントはデフォルト

  • NPC会話API/api/npc/conversations
  • マルチプレイヤー用API/api/skyway/token

インストール

npm install @ninjagl/api
# or
yarn add @ninjagl/api
# or
pnpm add @ninjagl/api

環境変数.envを使う場合の設定

# Chatbot
OPENAI_API_KEY=
# or ※REACT_APPでの指定は可視化されるのでテストのみで使用しましょう。
REACT_APP_OPENAI_API_KEY=


# SkywayToken
SKYWAY_APP_ID=
# or
REACT_APP_SKYWAY_APP_ID=

SKYWAY_APP_SECRET_KEY=
# or ※REACT_APPでの指定は可視化されるのでテストのみで使用しましょう。
REACT_APP_SKYWAY_APP_SECRET_KEY=

サンプル

OPENAI_API_KEY="sk-1..."
SKYWAY_APP_ID="2772279d-2e55-109e-189d-9db64dc4d427"
SKYWAY_APP_SECRET_KEY="mrkf5..."

Next.js Usage(AppRouter)

// app/api/skyway/token/route.ts
import { SkywayTokenApi } from "@ninjagl/api";

export async function GET(req: Request) {
  return Response(await SkywayTokenApi());
}
// app/api/npc/conversations/route.ts
import { NpcApi } from "@ninjagl/api";

export async function POST(req: Request) {
  const { conversations } = await req.json();
  return Response(await NpcApi());
}

Express Usage

import dotenv from 'dotenv';
import express from 'express';
import { SkywayTokenApi, NpcApi } from "@ninjagl/api";

dotenv.config();

const app = express();
const port = 5174;

app.get('/api/skyway/token', async (req, res) => {
  const response = await SkywayTokenApi();
  res.send(response.data);
});

app.post('/api/npc', async (req, res) => {
  const { conversations } = req.body;
  const response = await NpcApi(conversations);
  res.send(response.data);
});

app.listen(port, () => {
  console.log(`Backend listening at http://localhost:${port}`);
});

ライブラリメンテナ

// testcase
pnpm test
// publish
pnpm publish