blob: 729cfd5dc4b175d93c4c609426eacb4fcc5e369c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
This folder contains source for the fatcat API daemon ("fatcatd"), written in
golang.
## Structure
fatcatd is essentially just glue between two declarative schemas:
- a postgres-flavor SQL database schema
- an OpenAPI/Swagger REST API definition
## Dev Setup
- postgres 9.6+ running locally
- golang environment configured
- https://github.com/golang/dep
- checkout (or symlink) this repo to $GOPATH/src/git.archive.org/bnewbold/fatcat
- dep ensure
On debian/ubuntu:
sudo -u postgres createuser -s `whoami`
createdb -O `whoami` fatcat
psql fatcat -f fatcat-schema.sql
Build with:
go build ./cmd/*/
## Simplifications
In early development, we'll make at least the following simplifications:
- authentication (authn and authz) are not enforced and don't have user
interfaces. actual authentication will be eased in via a microservice and/or
oauth to gitlab/github/orcid.org
- "extra" metadata is stored in-entity as JSONB. In the future this might be
broken out to a separate table
- libraries won't be vendored; in the future they will be via a git submodule
## OpenAPI Code Generation
Install the go-swagger tool:
go get -u github.com/go-swagger/go-swagger/cmd/swagger
"Simple" server:
swagger generate server -A Fatcat -f fatcat-openapi2.yml
"Custom" server:
swagger generate server -A fatcat -f ./fatcat-openapi2.yml --exclude-main
|