Giter Club home page Giter Club logo

restful-keystone's Introduction

d-pac

Dependency Status devDependency Status

Digital platform for assessment of competences

NOT PRODUCTION READY

Not by a long shot.

Please visit http://www.d-pac.be for more information.

If you want to contribute you can start here

Installation

You need node and mongodb, then go to the directory you cloned this repo to and run:

$ npm install

Setup

You need to provide the system with some configuration details before it can run.

All mandatory settings are listed in EXAMPLE.env Just copy the file, rename it to .env and fill in all necessary details.

You'll have to setup an account with cloudinary and mandrill, both provide free plans.

Environment specific settings

If you want to run this in various environments you can override the base environment settings by providing environment specific .env files:

# file: .env.staging
MONGO_URI=mongodb://localhost/d-pac-staging
PORT=3030
# file: .env.production
debug=none

Starting the application

Run the application as any node app

$ node app/server.js

Or in a specific environment (by default a "development" environment is assumed)

$ NODE_ENV=staging node app/server.js

Obviously you can use process managers too e.g. nodemon or pm2

D-PAC Copyright (C) 2014-2016 d-pac http://www.d-pac.be

restful-keystone's People

Contributors

creynders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

restful-keystone's Issues

Non-GET requests logging errors

I have an un-usual situation where all non-get requests against models are returning 500 internal server error.

The error in the log is:

error: undefined error: Unknown keystone list "api" error: ReferenceError: Unknown keystone list "api" at list (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\lib\core\list.js:12:18) at C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\lib\core\routes.js:55:24 at Layer.handle [as handle_request] (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\layer.js:95:5) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:131:13) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) at next (C:\dev\workspace\oeh-assmt-mgmt\node_modules\keystone\node_modules\express\lib\router\route.js:125:14) POST /keystone/api/assessments 500 97.558 ms

Some snippets from how I configured restful keystone:

restful.expose({ Assessment: { methods: true } })

I also have a couple of keystone "pre" middleware configured for the purposes of token verification and logging.

Some keystone config:

`{

'name': 'oeh-assmt-mgmt',

'favicon': 'public/favicon.ico',
'less': 'public',
'static': ['public'],

'views': 'templates/views',
'view engine': 'jade',

'auto update': true,
'mongo': 'mongodb://localhost:27017/oeh-assmt-mgmt',

'session': false,
'auth': false,
'cookie secret': '(your secret here)'

}`

The GET request works fine:

GET /keystone/api/assessments

{ "results": [ { "id": "57d90b0dd55cf37c28e7d56b", "name": "57d90b0dd55cf37c28e7d56b", "fields": { "caseid": "1", "version": "1", "organisation": "envirokey", "blob": "{\"sdfsdf\": \"sdfsdfsdf\", \"32432\": true}" } } ], "count": 1 }

The POST request doesnt:

POST /keystone/api/assessments

not works for 0.3.15

I tested, not works for 0.3.15,
the result is 404 not found.
can you help to fix it? thanks.

Custom populate fields

How I can customize de fields of a populate?

Now it shows everything including the virtual fields.

"Complex" filters

Hi!

Would you help me find a way to filter API results based on dynamic filters (like 'give me all the news where publishing date is less or equal than today')?

Thank youuuuu :)

GET /api/users 404

I have been getting 404 errors when using it with keystone 3.0 (used 3.10 first then downgraded to 3.0 still the problem persists), appreciate any help.

package.json

   "keystone": "^0.3.0",
    "restful-keystone": "^0.3.0",
//routes/index.js
var keystone = require('keystone'),
    middleware = require('./middleware'),
    importRoutes = keystone.importer(__dirname);
var restful = require('restful-keystone')(keystone);
keystone.pre('routes', middleware.initLocals);
keystone.pre('render', middleware.flashMessages);
var routes = {
    views: importRoutes('./views')
};
exports = module.exports = function(app) {   
    restful.expose({
        User : true
    }).start(); 
};

Unable to update nested fields

I can successfully update first level fields, but, any field that is defined as nested in the Keystone model doesn't get updated. There are no errors, however nothing changes. Any suggestions on where to look for debugging clues?

I can take the output from a GET operation, change the values of certain fields and all except the nested fields will be updated after using the resulting JSON for a PATCH request...

POST Types.Location

Hi,
I couldnt find this anywhere, but is there an example POST request of an object that contains the Location type.
Preferably the GEO, for example, i am trying in my post request:
field: location.geo
value: [-0.2241442,51.4939545]

The response i get back is:
"number Cast to number failed for value [-0.2241442,51.4939545] at path location.geo"

This says to me that the location is trying to convert the array into a number, but surely its expecting two numbers? lat and long.

Local files are not exposed

Hi,

While the exposing of stored lists works fine, localFiles as part of an item lead to a 404. How does one make these accessible?

listing expose options

I have see the option show that does the magic to allow certain values to show at the api request. I have followed these examples but it doesnt get the showings limited on the listing.

restful.expose({
    Article : {
        show : "title content"
    }
});

and this

restful.expose({
    Article : {
        show : ["title", "author", "publishedDate", "content.brief"]
    }
});

is this possible do able to show at

restful.expose({
   Articles : {
        show : ["title", "author", "publishedDate", "content.brief"]
    }
});

so i can enable this feature on the listing request.

Security

Hi, great package, I'm just wondering how you recommend tackling securing a KeystoneJS REST API?
I'm assuming ideally we'd use JWTs and would need to provide an endpoint for users to get their tokens, then pass that token with each request in the header and Keystone would check that for each request. Just not sure how to implement. Thanks in advance.

Filter not working on retrieve method

Filter option is working as it should for the list method, but it returns results that should be filtered for the retrieve method. Is there a fix?

0.3 upgrade?

Hi, how is the 0.3.x upgrade going? :)

Need help? What needs to be done?

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.