API Endpoints for OSMod
Last updated 3 years ago by egreene .
Apache-2.0 · Original npm · Tarball · package.json
$ cnpm install @conversationai/moderator-backend-api 
SYNC missed versions from official npm registry.

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


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



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:



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


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.


We use TSLint for linting backend Typescript.


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

Current Tags

  • 1.0.6                                ...           latest (3 years ago)

6 Versions

  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Today 0
This Week 7
This Month 7
Last Day 0
Last Week 1
Last Month 8
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |