Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@weeb_services/wapi-core

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@weeb_services/wapi-core

Core module for weeb.sh APIs

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-40%
Maintainers
2
Weekly downloads
 
Created
Source

wapi-core

Core module for weeb.sh APIs

NPM XO code style

How to use it

  1. Install via Yarn or NPM
yarn add @weeb_services/wapi-core

npm i @weeb_services/wapi-core
  1. Create an index.js with the following code
const { WeebAPI } = require('@weeb_services/wapi-core');

class YourAPI extends WeebAPI {
	async onLoad() {
		// Called before the config is loaded
	}

	async onLoaded() {
		// Called after the config is loaded
	}

	async registerMiddlewares(app) {
		// Register your middlewares here
	}

	async registerRouters(app) {
		// Register your routers here
	}
	
	async onInitialized() {
		// Called after everything is setup and started
	}
}

new YourAPI().init();
  1. Create a folder called "config" in your project root and put a file called "main.json" into that with the following contents
{
	"host": "127.0.0.1",
	"port": 8080,
	"env": "development",
	"sentry": "",
	"track": "",
	"redis": "",
	"mongodb": "",
	"registration": {
		"enabled": false,
		"host": "",
		"token": "",
		"checks": null
	},
	"whitelist": [
		{
			"path": "/"
		}
	],
	"irohHost": "http://localhost:9010"
}
  1. Make sure you have a package.json file in your project root

  2. Run it! It should start up and show something if you open http://localhost:8080 in your browser. For authentication and such you should also get an instance of Iroh up and running and provide a token as a header.

How to develop with it

The module provides several utilites to help creating an API like a Router class and such. Here are some of the available classes:

const {
	Async,
	Constants,
	FileCache,
	Middleware,
	Redis,
	Require,
	Route,
	Router,
	Util,
	WeebAPI,
} = require('@weeb_services/wapi-core');

FAQs

Package last updated on 15 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc