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

@conversationai/moderator-backend-api

v1.0.6

Published

API Endpoints for OSMod

Downloads

10

Readme

Moderator Backend

The Moderator Backend is a Node.js/Express-backed service that provides several APIs for both the front end as well as interactions with external services.

Table of Contents

Installation

Adding docs on auth, adding table of contents to README This section will get the project running with all of its setup and dependencies.

Requirements

Deployment

See docs/deployment.md.

Development Server

Assuming you have Docker and Docker Compose installed, you should be able to cd into this directory and run:

docker-compose up

This will build or download Docker images and get them up and running locally. The API server should be accessible at http://localhost:3000. You can also daemonize the process so that you don't have to keep a tab open with the -d flag:

docker-compose -d up

To stop it:

docker-compose down

Docker Development Commands

Inside the Docker container, npm run watch will watch for Typescript changes, recompile them and those will trigger a node restart via Nodemon. Inside Docker, this will run on http://localhost:8080, but it is proxied to http://localhost:3000 by docker-compose.

Building the Docker Image

Since the server is running using Typescript and we don't want the production version running with Typescript, it needs to be compiled before build. A simple script has been put in bin/ to do so, which will compile the Typescript to a build/ directory, then build the Docker container:

bin/build

Testing

We use Mocha.js and Chai for testing. Tests will be run automatically on the continuous integration server automatically before deployment, so make sure you run tests locally before pushing anything.

To run the tests locally, simple run the following from the server directory on your VM:

npm test

Testing Via Docker

You can run tests via Docker so that you don't need to provision your own database:

npm run test-docker

Linting

The easiest way to lint your work is to run the linting script! From server directory on your VM:

npm run lint

This will fire off all the linters and fail if any code doesn't pass muster. Note that we run the linter script during the build, so if you're code doesn't pass linting the build will fail. Loudly.

TSLint

We use TSLint for linting backend Typescript.

Troubleshooting

Docker Compose error: no space left on device

The virtual machine is running out of memory. To fix this, you can manually provision a machine using Docker Machine and tell it to use more memory:


# Provision the virtual machine, change 2048 to something larger (n * 1024) if you still have issues

docker-machine create --driver virtualbox --virtualbox-memory 2048 some-machine-name

# Set environment variables to use it

eval "$(docker-machine env some-machine-name)"

# Run Docker Compose again

docker-compose up