Coder Social home page Coder Social logo

vandie / webmention-handler-mongo Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 34 KB

A Mongo DB Storage Handler for the Webmention Handler Project

Home Page: https://www.npmjs.com/package/webmention-handler-mongodb

License: MIT License

JavaScript 6.20% TypeScript 93.80%
javascript node nodejs indieweb typescript webmentions mongo mongodb mongoose

webmention-handler-mongo's Introduction

MongoDB Webmention Storage

A Mongo DB Storage Handler for the Webmention-Handler as used on mikevdv.dev

Installation

Install with npm

npm install webmention-handler-mongodb --save

Usage

Create a new instance of MongoWebMentionStorage

import { MongoWebMentionStorage } from 'webmention-handler-mongodb';

const storage = new MongoWebMentionStorage({
  databaseUri: 'your-mongo-db-database-uri-here',
  dbName: 'webmentions', // Your db name
  mentionCollection: 'mentions', // The collection you want to use for parsed mentions
  pendingCollection: 'pendingMentions', // The collection you want to use for pending mentions
  maxPendingFetch: 100, // The maximum number of pending mentions to fetch at a time
  limitMentionsPerPageFetch: 50 // The maximum number of parsed mentions to fetch at a time
});

Pass your instance to webmention-handler.

import { WebMentionHandler } from 'webmention-handler';

const options = {
  supportedHosts: ['localhost'] // The domain of any websites this handler should support
  storageHandler: storage, // pass in your storage handler instance
  requiredProtocol: 'https' // Not required, but highly recommended to only allow https mentions
};
export const webMentionHandler = new WebMentionHandler(options)

Follow the documentation for Webmention-Handler

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.