Skip to content
Snippets Groups Projects
Commit 6130aa35 authored by Yannis Barlas's avatar Yannis Barlas
Browse files

Merge branch 'export-base-model' into 'master'

feat(server): export BaseModel

Closes #3

See merge request !4
parents 9a9415d0 4301538d
No related branches found
No related tags found
1 merge request!4feat(server): export BaseModel
......@@ -7,7 +7,10 @@ It is also meant to bundle as many server-side pubsweet dependencies as possible
Install package and remove the dependencies it is meant to replace.
```sh
yarn remove pubsweet pubsweet-server @pubsweet/logger # if migrating from an existing project
## if migrating from an existing project
yarn remove pubsweet pubsweet-server @pubsweet/logger @pubsweet/base-model
##
yarn add @coko/server
```
......@@ -36,14 +39,6 @@ If you place this file in `server/app.js`, starting the server should work autom
}
```
### Logger
To access the logger simply import like so:
```js
const { logger } = require('@coko/server')
```
### Authorization middleware
The server provides authorization checks through using `graphql-shield`.
......@@ -136,7 +131,26 @@ If you run your client on a different host/port than the server, you might run i
### Other exports from included packages
- `createJWT` is an export of a function in `pubsweet-server` that does just that. Useful if you have custom login resolvers.
##### Logger
Returns pubsweet's logger
```js
const { logger } = require('@coko/server')
```
##### Base Model
Returns pubsweet's base model
```js
const { BaseModel } = require('@coko/server')
```
##### createJWT
`createJWT` is an export of a function in `pubsweet-server` that does just that.
Useful if you have custom login resolvers.
### Future features
......
......@@ -23,6 +23,7 @@
"access": "public"
},
"dependencies": {
"@pubsweet/base-model": "^3.6.5",
"@pubsweet/errors": "^2.0.32",
"@pubsweet/logger": "^0.2.42",
"@pubsweet/models": "^0.3.7",
......
const cron = require('node-cron')
const BaseModel = require('@pubsweet/base-model')
const authentication = require('pubsweet-server/src/authentication')
const logger = require('@pubsweet/logger')
......@@ -12,4 +13,5 @@ module.exports = {
cron,
createJWT,
logger,
BaseModel,
}
......@@ -411,6 +411,34 @@
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=
"@pubsweet/base-model@^3.6.5":
version "3.6.5"
resolved "https://registry.yarnpkg.com/@pubsweet/base-model/-/base-model-3.6.5.tgz#a2a6dd9be999b8360abbb0a4a1a22cb9b6b7aa37"
integrity sha512-zhqh8cQL+0rE1U0PbeKUy+Vr7BvF4D/AoW57pI6JnGBZ8iaLtes49Vbzgj4aykQZKgzxraXyJssFHAn1E74TSQ==
dependencies:
"@pubsweet/db-manager" "^3.1.10"
"@pubsweet/errors" "^2.0.35"
"@pubsweet/logger" "^0.2.45"
knex "^0.16.3"
lodash "^4.17.11"
objection "^1.5.3"
uuid "^3.3.2"
"@pubsweet/db-manager@^3.1.10":
version "3.1.10"
resolved "https://registry.yarnpkg.com/@pubsweet/db-manager/-/db-manager-3.1.10.tgz#a4165be9199fc2d04150ad746d9d328d9ab91c46"
integrity sha512-h9jW/IIYlMgV5exqZZdpmgp6L8Ef8+aVHI7c6nNQT2jaJIVR3ZhmgrjNNWnT9faptInoU/VoF6JUz5/vZKIBAg==
dependencies:
"@hapi/joi" "^14.3.0"
"@pubsweet/logger" "^0.2.45"
fs-extra "^8.1.0"
knex "^0.16.3"
lodash "^4.17.11"
objection "^1.5.3"
pg "^7.8.0"
tmp-promise "^2.0.0"
umzug "^2.1.0"
"@pubsweet/db-manager@^3.1.7":
version "3.1.7"
resolved "https://registry.yarnpkg.com/@pubsweet/db-manager/-/db-manager-3.1.7.tgz#504b78f036240d3b2e2144caff424fcf38beb72a"
......@@ -433,6 +461,13 @@
dependencies:
http-status-codes "^1.3.0"
"@pubsweet/errors@^2.0.35":
version "2.0.35"
resolved "https://registry.yarnpkg.com/@pubsweet/errors/-/errors-2.0.35.tgz#40a0c231cf5a7ab4aeafd6d20835a092fd55fcec"
integrity sha512-u3eR2lFDydyIVZkxkfXUHhfw0i7usOSVlPmBlcr547qGADPJ8HB4lMTSFoq20Ks7Vij3xeW1Vu6r2Mfqo3uRhQ==
dependencies:
http-status-codes "^1.3.0"
"@pubsweet/logger@^0.2.42":
version "0.2.42"
resolved "https://registry.yarnpkg.com/@pubsweet/logger/-/logger-0.2.42.tgz#e2fa0e053441868d090bcfff36333ffabda550ee"
......@@ -441,6 +476,14 @@
"@hapi/joi" "^14.5.0"
config "^3.0.1"
"@pubsweet/logger@^0.2.45":
version "0.2.45"
resolved "https://registry.yarnpkg.com/@pubsweet/logger/-/logger-0.2.45.tgz#dbf176a5816e4c5fbc4ba0fed5c996fa2e24c288"
integrity sha512-9s4cb+3vgPGQT6JUbDaiX3Q0KSU2vFDB+jMAj96RlIn88PUVa6dHBJBb1V7SMlPQ493S9dfOJ3lFJQhh+HNA5Q==
dependencies:
"@hapi/joi" "^14.5.0"
config "^3.0.1"
"@pubsweet/models@^0.3.7":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@pubsweet/models/-/models-0.3.7.tgz#b19bf7b615329e2fdeab6acb64a892d2663c3569"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment