stormpath-spa-dev-server

Stormpath development server that provides your SPA or mobile app with a Stormpath integrated back-end.

Usage no npm install needed!

<script type="module">
  import stormpathSpaDevServer from 'https://cdn.skypack.dev/stormpath-spa-dev-server';
</script>

README

Stormpath SPA Development Server

NPM Version NPM Downloads

Stormpath development server that provides your Single-Page-App (SPA) or mobile app with a Stormpath integrated back-end.

Front-end applications can not communicate with the Stormpath API directly, and thus need an integrated back-end. Before your back-end has been integrated, use this development server when integrating Stormpath with your front-end app. It will serve all the necessary JSON endpoints for your front-end application, and will integrate directly with our Angular SDK. and React SDK.

Install

  1. Make sure you have Node.js installed
  2. Install the server
$ npm install -g stormpath-spa-dev-server
  1. Download an API Key Pair from the Stormpath Admin Console.

  2. Login to the Stormpath Admin Console and find the Application Href (also called REST URL) of the Application that you will use for your project. The default application is called "My Application" and you can use that to get started.

  3. Provide the API Key ID, API Key Secret, and Application Href to your environment, with one of these strategies:

Unix Environment Variables:

export STORMPATH_CLIENT_APIKEY_ID=YOUR_ID_HERE
export STORMPATH_CLIENT_APIKEY_SECRET=YOUR_SECRET_HERE
export STORMPATH_APPLICATION_HREF=YOUR_APP_HREF

Unix Environment Variables:

set STORMPATH_CLIENT_APIKEY_ID=YOUR_ID_HERE
set STORMPATH_CLIENT_APIKEY_SECRET=YOUR_SECRET_HERE
set STORMPATH_APPLICATION_HREF=YOUR_APP_HREF

Place them in a file named stormpath.yml, in the directory where you run the dev server:

client:
  apiKey:
    id: YOUR_API_KEY_ID
    secret: YOUR_API_KEY_SECRET
application:
  href: https://api.stormpath.com/v1/applications/XXXX

Usage

  1. Start the server with the JSON API, and serve your SPA assets:
$ stormpath-spa-dev-server /home/joe/dev/my-angular-app/

It's now listening at http://localhost:3000/ and ready to use with your front-end app

  1. Or have it just serve the JSON API, and you can serve your SPA as you please:
$ stormpath-spa-dev-server --origin http://localhost:4000

Note: in this situation you need to tell us where your SPA is being run (the origin option), so that we can serve the necessary CORS headers.

Support

We're here to help if you get stuck. There are several ways that you an get in touch with a member of our team:

License

Apache 2.0, see LICENSE.