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

odataserver2

v0.0.22

Published

OData server on top of MySQL and LeveDb

Downloads

21

Readme

odataserver2

Odataserver rewritten from scratch. Now modularized and built using streams.

Pre-requisites

NodeJS and a MySQL (or MariaDB) needs to be installed.

Getting started

First install the with npm install

Make sure that MySQL is running, create setenv by copying setenv.template and update with the database credentials. On Windows, create setenv.bat using setenv.template.bat.

Start the server: source setenv; node odataserver2. On Windows run setenv.bat followed by node odataserver2.

Run the tests to see that everything works: node test_mysql.js

Process management

There are man different process management tools. I'm using supervisor. A NodeJS based alternative is forever.

Here is an example of a supervisor configuration (update the this according to your setup).

[program:odataserver2]
directory=/apps
environment =
  DB_HOST="mariadb",
  ADMIN_USER="root",
  ADMIN_PASSWORD="secret",
  MAIL_USER="[email protected]",
  MAIL_PASSWORD="secret"
command=node /apps/node_modules/odataserver2/odataserver2.js
stdout_logfile=syslog
stderr_logfile=syslog
autorestart=true

Basic HTTP authentication

It is now possible to authenticate users with basic HTTP authentication and build a custom authentication model. See connectbasicauth for details on how this is done.

ToDo

Rewrite the tosql function into a stream. This will make it possible to pass statement by statement to MySQL instead of just returning a string with many statements separated with semicolon. This will make it possible to always send a header in an operation, also before any errors might occur.

Troubleshooting

Solutions to some problems:

  • Q: [Error: value required in setHeader("password", value).]

  • A: Make sure that setenv is correct and used: source setenv

  • Q: I get an assert error in the mysql unit test: ERROR { [AssertionError: POST delete_table]

  • A: The reason is that the warningCount is 1 instead of 0 on some installations. Any problems due to this has not been observed.