JSPM

warp-server

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 40
  • Score
    100M100P100Q79656F
  • License MIT

WarpServer

Package Exports

  • warp-server

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (warp-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

WarpServer

WarpServer is a library for implementing the Warp Framework on Node.js. It consists of several classes similar to the ParsePlatform [https://github.com/ParsePlatform] which aim to produce endpoints easily accessible via a standard REST API. Currently, WarpServer uses mysql as its backend of choice and implements validators, parsers and formatters that can control the data coming in and out of the server.

Installation

To install WarpServer via npm, simply use the install command to save it in your package.json:

npm install --save warp-server

Configuration

WarpServer is built on top of express and can be initialized in any express project. To do so, simply add the following configruation to the main file of your project:

// Require WarpServer
var WarpServer = require('warp-server');

// Prepare config; You can also use process.env or store the config in a json file
var config = {
    host: 'localhost',
    port: 3306,
    user: 'root',
    password: 'password',
    default: 'default_table',
    apiKey: '12345678abcdefg'
};

// Create a WarpServer router for the API
var api = WarpServer.initialize(config);

// Apply the WarpServer router to your preferred base URL, using express' app.use() method
app.use('/api/1', api);