Giter Site home page Giter Site logo

arcesino / express-raml-store Goto Github PK

View Code? Open in Web Editor NEW

This project forked from colthreepv/express-raml-store

0.0 2.0 0.0 47 KB

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

License: MIT License

RAML 4.44% JavaScript 95.56%

express-raml-store's Introduction

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

express-raml-store's People

Contributors

brianmc avatar jacobsvante avatar

Watchers

James Cloos avatar Ignacio Arces avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.