Giter VIP home page Giter VIP logo

user-acl-mock's Introduction

user-acl-mock

A mock service using Express.js & CouchDb to allow open source development of npm website code.

Application Structure

.env

Read, throw the .env file at root of this project. And change the environment variables for your couch and app accordingly.

app

The app directory contains four modules (organizations, packages, scopes, teams, users) which contains the logic to serve the request. Each of those modules have similar structure comprising of:

  • db directory e.g. db
  • handlers.js
  • routes.js
  • validators.js
db

The db directory contains the following two types of files:

  • designDoc.json, which have couch design document which is preloaded on start of application.
  • queries.js, contians the database logic associated with each route in that particular module.
handlers.js

This file contains handlers (sometimes called controllers) are functions that accepts two parameters: request and response

The request parameter is an stream with details about the end user's request, such as path parameters, headers, payload &c.

The second parameter, response, is the stream used to respond to the request.

routes.js

This file contains logic that registers http method, path ,validator and handler to the app.

validators.js

This app uses Joi for validations of params, body, headers and query. It exports the validation objects for each handler.

config

The config directory contains the config file which is used by wrapper written on top of nano to connect to CouchDb.

couchapp

The couchapp directory contains the scripts which are used to preload the fixture documents and design documents into the CouchDb.

fixtures

The fixtures directory contains the mock documents which are inserted in the CouchDb on start of the app.

lib

The lib directory contains the wrapper libraries and shared code used in app.

test

the test directory contains the API test cases written using supertest.

Use

To start the app localy, do the following which will run the pretest script which will setup db and load docs and views into couchdb

npm install
npm start

Tests

To run the tests, do the following

npm test

user-acl-mock's People

Contributors

aks- avatar aredridel avatar

Stargazers

Jonathan Barnett avatar

Watchers

James Cloos avatar

Forkers

aredridel

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.