Giter Site home page Giter Site logo

dar-server's Introduction

Dar Server

Node.js based filesystem backend for document archives (Dar). You can find examples here.

Install

$ git clone https://github.com/substance/dar-server.git
$ cd dar-server
$ npm install

Integration into a custom Express application

let express = require('express')
let darServer = require('dar-server')
let path = require('path')

const port = 4000
const rootDir = path.resolve(path.join(__dirname, 'archives'))

let app = express()
darServer.serve(app, {
  port,
  serverUrl: 'http://localhost:' + port,
  rootDir
})

app.listen(port, () => {
  console.log(`Running dar-server on port ${port}`)
})

To avoid name clashes with your own express end-points you can provide an apiUrl

darServer.serve(app, {
  port,
  serverUrl: 'http://localhost:' + port,
  rootDir,
  apiUrl: '/archives'
})

Command-line tool

This module comes with a command-line tool that starts dar-server in a new express instance.

$ npm install -g dar-server
$ dar-server ./my-archives
DAR server is running on http://localhost:4100

To start you could take the examples from the DAR repository:

git clone https://github.com/substance/dar.git

and then start the dar-server using

dar-server ./dar/examples

After that you should be able to open

http://localhost:4100/!list

in the browser and see a listing of found archives. Notice, that dar-server is just a backend for serving archives. To be able to read and edit the context you need to use Texture.

dar-server's People

Contributors

integral avatar obuchtala avatar oliver7654 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

aluisioasg

dar-server's Issues

Instructions lead to 404 not found

$ git clone https://github.com/substance/dar-server.git
$ cd dar-server

-- here I created an archives folder and a sub folder named example1, in which I placed the example from https://github.com/substance/dar/tree/master/examples/classic-manuscript

$ npm install
$ node lib/server.js -d /archives/example1

Instructions say that I can access /archives/example1 via http://localhost:5000/example1
However, this shows the following error in the browser

Failed to load resource: the server responded with a status of 404 (Not Found) at the path http://localhost:5000/example1

[Proposal] New version of the dar-server as part of the "dar-backend-suite"

Hello,

I have created a new version of the dar-server.

It is a koa.js application which can read/write Dars from filesystem as well as from a MongoDB database.

The new dar-server should be backward-compatible with the current implementation, however I'm not a 100% sure.

The dar-server is furthermore part of a "dar-backend-suite" (didn't came up with a better name yet).

The dar-backend-suite is a collection of packages which a developer can use to create backends for Dar-based client applications. Every package constitutes an npm packge in it's own right and can be added to a project as a dependency. All in all the developer can pick and choose those packages he needs. Furthermore, the division of the different components into separate packages makes the code easier to understand and fosters code reuse.

Since the dar-server is part of this suite I didn't issue a pull request. If you like the new version of the dar-server as well as the approach taken with the dar-backend-suite maybe a new repository could be created within the "substance-workspace".

Best regards, Matthias

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.