Skip to content

Commit

Permalink
Move adaptor to API
Browse files Browse the repository at this point in the history
  • Loading branch information
pointful-mikkel committed Mar 17, 2015
1 parent 3efd06f commit 21e87e9
Show file tree
Hide file tree
Showing 26 changed files with 2,395 additions and 2,393 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ node_modules
client/miso.js
client/miso.map.json
system/main.js
system/adaptor/flatfiledb/data/flat-data-file.db
system/adaptor/*/api.client.js
system/adaptor/*/api.server.js
modules/adaptor/*/api.client.js
modules/adaptor/*/api.server.js
system/api/flatfiledb/data/flat-data-file.db
system/api/*/api.client.js
system/api/*/api.server.js
modules/api/*/api.client.js
modules/api/*/api.server.js
documentation/misojs.wiki/
2 changes: 1 addition & 1 deletion bin/miso.bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var argv = require('minimist')(process.argv.slice(2)),
// What to exclude
excludeFiles = ['mvc', 'modules', 'documentation', 'skeletons', 'bin', 'README.md', ''],
// What to always copy
copyFiles = ['mvc/layout.js', 'modules/adaptor/authentication/authentication.adaptor.js'],
copyFiles = ['mvc/layout.js', 'modules/api/authentication/authentication.api.js'],
// Creates a new project folder and copies all required files
createProject = function(projectPath, projectName){
if(!fs.existsSync(projectPath)) {
Expand Down
2 changes: 1 addition & 1 deletion cfg/server.development.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"minify": false,
"pretty": true,
"reload": true,
"adaptor": ["flatfiledb", "flickr", "authentication"]
"api": ["flatfiledb", "flickr", "authentication"]
}
2 changes: 1 addition & 1 deletion cfg/server.developmentforever.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"minify": false,
"pretty": true,
"reload": true,
"adaptor": "flatfiledb"
"api": "flatfiledb"
}
4 changes: 2 additions & 2 deletions cfg/server.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
},
"authKey": "secretauthkey",
"apiPath": "/api",
"COMMENT_adaptor": "mongoose",
"adaptor": "flatfiledb",
"COMMENT_api": "mongoose",
"api": "flatfiledb",
"minify": true,
"pretty": false
}
6 changes: 4 additions & 2 deletions documentation/future_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

Immediate for next release:

* Rename "adaptor" to "api", place it in /api
* Remove /client and /severs directories, and use an extension of "X.client.js" for non-server, (eg: for miso.util.js, to create a client replacement, add a file named: miso.util.client.js). Everything goes in /modules (this already works, I just need to refactor the code)
* Rename "adaptor" to "api", place it in /api.

[done] * Remove /client and /severs directories, and use an extension of "X.client.js" for non-server, (eg: for miso.util.js, to create a client replacement, add a file named: miso.util.client.js). Everything goes in /modules (this already works, I just need to refactor the code) - everything client will be in /public instead.

* Use Create, Retrieve, Update, Delete, Query in the api examples instead of Find, Save, Remove - this removes the "magic" we're doing with the ID in the flatfile and mongoose adaptors - it needs to be un-opinionated, and it is better if the user handles this, instead of being forced to use "_id".

Near future:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// miso login adaptor example
var ffdba = require('../../../system/adaptor/flatfiledb/flatfiledb.adaptor.js'),
// miso login api example
var ffdba = require('../../../system/api/flatfiledb/flatfiledb.api.js'),
_ = require('lodash'),
uuid = require('node-uuid'),
bcrypt = require('bcrypt');

// Extend the flatfiledb adaptor with login-specfic methods
// Extend the flatfiledb api with login-specfic methods
module.exports = function(utils){
var db = ffdba(utils),
modelType = 'user.edit.user';
Expand Down Expand Up @@ -46,7 +46,7 @@ module.exports = function(utils){


// TODO: We need to ba able to restrict user model access
// by adaptor type.
// by api type.


// Load users, excluding the password hash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// endpoint adaptor to make http requests via flickr
// endpoint api to make http requests via flickr
var request = require('request'),
miso = require('../../../modules/miso.util.js'),
// Parse out the unwanted parts of the json
Expand Down
2 changes: 1 addition & 1 deletion modules/miso.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = {
},

/* Use a JSON RPC 2.0 response
this is used by the server response in the adaptor.
this is used by the server response in the api.
*/
response: function(result, err, id){
var res = {
Expand Down
2 changes: 1 addition & 1 deletion mvc/flickr.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var m = require('mithril'),
miso = require('../modules/miso.util.js'),
sugartags = require('mithril.sugartags')(m),
flickr = require('../modules/adaptor/flickr/api.server.js')(m);
flickr = require('../modules/api/flickr/api.server.js')(m);

var index = module.exports.index = {
models: {
Expand Down
2 changes: 1 addition & 1 deletion mvc/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports.index = function(ctrl){
LINK({href: '/css/style.css', rel:'stylesheet'}),
// Add in the session object...
// it will need to automatically communicate
// with the session endpoint in authenticate adaptor...
// with the session endpoint in authenticate api...
(ctrl.session?
SCRIPT("var misoSession = "+JSON.stringify(ctrl.session)+";"):
[]
Expand Down
4 changes: 2 additions & 2 deletions mvc/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var m = require('mithril'),
miso = require('../modules/miso.util.js'),
sugartags = require('mithril.sugartags')(m),
ldb = require('../modules/adaptor/authentication/api.server.js')(m);
ldb = require('../modules/api/authentication/api.server.js')(m);

var index = module.exports.index = {
models: {
Expand All @@ -22,7 +22,7 @@ var index = module.exports.index = {
// the server.
// Now, how to we get it to the client?
//
// Idea: use an adaptor endpoint
// Idea: use an api endpoint
// that can be used to store/get session
// info. We need to load the session info
// when the page is loaded, so we need a way
Expand Down
2 changes: 1 addition & 1 deletion mvc/todo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var m = require('mithril'),
sugartags = require('mithril.sugartags')(m),
db = require('../system/adaptor/flatfiledb/api.server.js')(m);
db = require('../system/api/flatfiledb/api.server.js')(m);

var self = module.exports.index = {
models: {
Expand Down
2 changes: 1 addition & 1 deletion mvc/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var miso = require('../modules/miso.util.js'),
m = require('mithril'),
sugartags = require('mithril.sugartags')(m),
bindings = require('mithril.bindings')(m),
api = require('../modules/adaptor/authentication/api.server.js')(m),
api = require('../modules/api/authentication/api.server.js')(m),
self = module.exports;

// Shared view
Expand Down
8 changes: 4 additions & 4 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"ignore": [
"system/adaptor/*/api.client.js",
"system/adaptor/*/api.server.js",
"modules/adaptor/*/api.client.js",
"modules/adaptor/*/api.server.js",
"system/api/*/api.client.js",
"system/api/*/api.server.js",
"modules/api/*/api.client.js",
"modules/api/*/api.server.js",
"system/main.js",
"client/miso.js",
"client/miso.documentation.js"
Expand Down
Loading

0 comments on commit 21e87e9

Please sign in to comment.