A Nodejs Test Server For Kinto

A Nodejs Test Server For Kinto

A nodejs test server for Kinto .A Node and browser API for operating a Kinto test server providing the following features:

kinto-node-test-server

A Node and browser API for operating a Kinto test server providing the following features:

  • starting a server (optionally with supplementary configuration flags)
  • stopping a server
  • flushing a server
  • killing a running server

Note that a Python virtualenv must be installed in your project, and the kinto pip package installed within that environment.

Prerequisites

Node >= v10 is required.

Installation

$ npm install kinto-node-test-server --save-dev
$ virtualenv .venv -p python3
$ .venv/bin/pip install kinto

Please make sure to create an appropriately configured Kinto ini file.

Node API

Sample usage using mocha:

import KintoServer from "kinto-node-test-server";

describe("Test Kinto server", function() {
  let server;

  before(function() {
    server = new KintoServer("http://0.0.0.0:8888/v1", {
      kintoConfigPath: __dirname + "/kinto.ini",
    });
  });

  after(function() {
    server.killAll();
  });

  describe("Default test server", function() {
    beforeEach(function() {
      return server.start();
    });

    afterEach(function() {
      return server.stop();
    });

    it("should flush a server", function() {
      return server.flush().then(function() {
        console.log("yay flushed");
      });
    });
  });
});

CommonJS

If you're using the library in a CommonJS environment, you'll need to use the following to import the library:

const KintoServer = require("kinto-node-test-server").default;

Note that all KintoServer instance methods return Promises.

Browser API

The browser client follows the same API as the Node client. The browser client requires a proxy server, which you can launch with the following:

import { KintoProxyServer } from "kinto-node-test-server";

const server = new KintoProxyServer();
await server.startServer();

You can then connect to to the proxy server and use the same Node API with the following:

import KintoServer from "kinto-node-test-server";
// Note that the proxy server runs on port 8899
const server = new KintoServer("http://0.0.0.0:8899/v1");

Configuration

The KintoServer constructor requires the base URL of your kinto server instance and accepts an options object:

  • maxAttempts: The number of attempts retrying to connect to the server (default: 50)
  • kintoConfigPath: The path to your Kinto ini config file (default: __dirname + "/kinto.ini")
  • pservePath: The path to the .venv pserve executable (default: "pserve"); if the default value doesn't work, try ".venv/bin/pserve".

Download Details:

Author: Kinto

Source Code: https://github.com/Kinto/kinto-node-test-server

node nodejs javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Node canvas is a Cairo backed Canvas implementation for NodeJS.

node-canvas is a Cairo-backed Canvas implementation for Node.js.

How to Hire Node.js Developers And How Much Does It Cost?

A Guide to Hire Node.js Developers who can help you create fast and efficient web applications. Also, know how much does it cost to hire Node.js Developers.

Hire NodeJs Developer

Looking to build dynamic, extensively featured, and full-fledged web applications? **[Hire NodeJs Developer](https://hourlydeveloper.io/hire-dedicated-node-js-developer/ "Hire NodeJs Developer")** to create a real-time, faster, and scalable...

Decoding Nodejs

The main goal of this blog is to explain the “Architecture of Nodejs” and to know how the Nodejs works behind the scenes. Generally, most of the server-side languages, like PHP, ASP.NET, Ruby, and including Nodejs follows multi-threaded architecture. That means for each client-side request initiates a new thread or even a new process.

Node.js for Beginners - Learn Node.js from Scratch (Step by Step)

Node.js for Beginners - Learn Node.js from Scratch (Step by Step) - Learn the basics of Node.js. This Node.js tutorial will guide you step by step so that you will learn basics and theory of every part. Learn to use Node.js like a professional. You’ll learn: Basic Of Node, Modules, NPM In Node, Event, Email, Uploading File, Advance Of Node.