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

express-raml-store

v1.2.2

Published

Express 4 Router to serve mulesoft's api-designer, and save your work on filesystem

Downloads

70

Readme

express-raml-store

fork of arthurtsang/raml-store, that is a fork of brianmc/raml-store.
Is an Express module serving the awesome work of mulesoft/api-designer

Instead of saving to mongodb, it saves to the filesystem directly, exportes an handy Express 4 Router that you can mount on your desired endpoint

what

This package is meant to be mounted on your express server when in development mode, allowing to edit the API specification on-the-fly and ALSO test it (if your development server handles the API)

Example:

var app = require('express');
var ramlStore = require('express-raml-store');

// webpages
app.get('/', serveMyHomePage);
app.get('/admin/', greatAdminPanel);

// REST API
app.get('/api/', apiHandler);

if (process.env.NODE_ENV !== 'production') {
  app.use('/api-docs/', ramlStore(path.join(__dirname, 'raml-dir/')));
}

// continue until...
app.listen(3000)

how to use

Just include the module and specify the directory where you desire to host RAML files.

var path = require('path');
var express = require('express');
var ramlStore = require('express-raml-store');
var app = express();

app.use('/raml-store', ramlStore(path.join(__dirname, 'raml-dir/')));
var server = app.listen(3000, function () {
  console.log('Open http://localhost:%d/raml-store/ to browse api-designer', server.address().port);
});

express-raml-store also works as stand-alone:

$ RAML_DATAPATH=api-spec/raml/ node raml-store.js

TODO(s)

I noticed that path traversing is not my best skill, as you see in the example I give up and suggest to use path.join(__dirname, '<ramlPath>') I think this is a good approach, but I'd rather make the library a little more clever on path solving.
PR are very welcome!

Contributors

Changelog

1.2.1 (2015-10-25)

  • now supports both npm (2.x) and npm@next or npm@3, the 3.x branch default with nodejs 5.x

1.2.0 (2015-08-18)

**using api-designer package from npm

1.1.2 (2015-07-08)

bluebird dependency added

  • Bluebird Dependency #4

1.1.0 (2015-05-31)

Node.js is now supported

  • Node.js support #3