Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
okdistribute committed Jun 6, 2017
1 parent 88075db commit 4974600
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 118 deletions.
128 changes: 10 additions & 118 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,128 +1,20 @@
# datproject.org
# Dat Registry

A registry for dats. [datproject.org](http://datproject.org)
A web registry for the dat network. Hosted at [http://datproject.org](http://datproject.org).

[![Build Status](https://travis-ci.org/datproject/datproject.org.svg?branch=master)](https://travis-ci.org/datproject/datproject.org)

### Develop
## Features

Install dependencies.
* Preview the files in a dat in the browser.
* Download individual files from dats.
* Create short links for dats with user accounts.

```
npm install
```

Create config file.

You can use override the defaults by copying the example config to `config.local.js` and make changes.

Initialize the database. You only have to do this once:

```
node server/database/init.js
```


Watch assets and start server in one command:

```
npm start
```

### Creating examples
## Setup

Run the following command to create a user with the given email address. The
user will have the password `dogsandcats.`
Clone this repository, then copy the default config file to `config.local.js`

```
node scripts/user-and-dat.js <email-address>
```

To create just dats for a given user that already exists, use
```
node scripts/add-dats-for-user.js <email-address> <password>
```



### Build for production
```
npm run build
npm run minify
npm run version
```

### Getting invited-users list

```
git clone [email protected]:datproject/invited-users.git
```


### Running end-to-end tests

Docker and `docker-compose` are required.

```
docker-compose build
docker-compose up -d newdat && sleep 10
docker-compose run --rm nightwatch
```

You may also see the test browser in action with [VNC](https://github.com/blueimp/nightwatch).

## API

##### ```GET /api/v1/:model```

Can pass query parameters like `?username='martha'` to filter results.

Additional options:

* `limit`: 100 (default)
* `offset`: 0 (default)

##### ```POST /api/v1/:model```

Success returns model with `id` field added.

##### ```PUT /api/v1/:model?id=```

`id` required

Success returns number of rows modified.
```
{updated: 1}
```

##### ```DELETE /api/v1/:model?id=```

`id` required

Success returns number of rows deleted.
```
{deleted: 1}
npm install
cp config/index.js config.local.js
```

##### users model: ```/api/v1/users```

- `id` (required)
- `email` (required)
- `username`
- `description`
- `created_at`
- `updated_at`

##### dats model: ```/api/v1/dats```

- `id`
- `user_id`
- `name`
- `title`
- `hash`
- `description`
- `created_at`
- `updated_at`

##### ```/api/v1/register```
##### ```/api/v1/login```
55 changes: 55 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## API

##### ```GET /api/v1/:model```

Can pass query parameters like `?username='martha'` to filter results.

Additional options:

* `limit`: 100 (default)
* `offset`: 0 (default)

##### ```POST /api/v1/:model```

Success returns model with `id` field added.

##### ```PUT /api/v1/:model?id=```

`id` required

Success returns number of rows modified.
```
{updated: 1}
```

##### ```DELETE /api/v1/:model?id=```

`id` required

Success returns number of rows deleted.
```
{deleted: 1}
```

##### users model: ```/api/v1/users```

- `id` (required)
- `email` (required)
- `username`
- `description`
- `created_at`
- `updated_at`

##### dats model: ```/api/v1/dats```

- `id`
- `user_id`
- `name`
- `title`
- `hash`
- `description`
- `created_at`
- `updated_at`

##### ```/api/v1/register```
##### ```/api/v1/login```
45 changes: 45 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing

Install dependencies.

```
npm install
```

Initialize the database. You only have to do this once:

```
node server/database/init.js
```

Watch assets and start server in one command:

```
npm start
```

## Creating example user and dat

Run the following command to create a user with the given email address. The
user will have the password `dogsandcats.`

```
node scripts/user-and-dat.js <email-address>
```

To create just dats for a given user that already exists, use
```
node scripts/add-dats-for-user.js <email-address> <password>
```

## Running end-to-end tests

Docker and `docker-compose` are required.

```
docker-compose build
docker-compose up -d newdat && sleep 10
docker-compose run --rm nightwatch
```

You may also see the test browser in action with [VNC](https://github.com/blueimp/nightwatch).
6 changes: 6 additions & 0 deletions docs/deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Build for production
```
npm run build
npm run minify
npm run version
```

0 comments on commit 4974600

Please sign in to comment.