Giter Site home page Giter Site logo

jonabrams / synth Goto Github PK

View Code? Open in Web Editor NEW
968.0 968.0 70.0 2.45 MB

The first back-end framework specially designed for single-page web applications

Home Page: http://www.synthjs.com

License: MIT License

Makefile 0.24% JavaScript 97.09% CSS 0.97% HTML 1.66% CoffeeScript 0.03%

synth's People

Contributors

jonabrams avatar ky0615 avatar monthypython avatar pchw avatar yudppp 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  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

synth's Issues

bower provided fonts missing in production mode

I've been playing around with synth and have found it pretty awesome to do front end prototyping with. One issue I ran into is that if you use bower to load a library like font-awesome it will not properly load the fonts when running synth in production mode. JS and CSS work fine but somehow fonts is getting lost in there.

Global install insufficent

I had to install Synth globally, and locally inside my app, to get it to work. Otherwise, I recieved the error:

module.js:340
    throw err;
    ^
Error: Cannot find module 'synth'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/Kenneth/Desktop/my_app/back/back-app.js:1:75)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Tell user that they are missing packages when launching server

Right now, if you forget to run synth install -b or synth install -f before launching the server, either server will fail to start with errors about missing packages or things will just be flat out broken.

The synth server command should check to see if all the required third-party packages are installed before running the server, and tell the user how they can install the missing packages.

Catch errors when reloading synth app

When synth in dev mode notices a back-end file has changed, it restarts the app. But if that app has a syntax error (or something similar), the entire process fails and needs to be manually restarted. Instead, it should catch the error and wait until another file is changed before restarting again.

synth server command complains not reading manifest files

node v0.10.26
npm v1.4.3

all installation ok, front and back installed successfully.
now run

synth server

I got

Could not read js manifest files.
Make sure one exists at front/js/jsFiles
Could not read css manifest files.
Make sure one exists at front/css/cssFiles
synth (in development mode) is now listening on port 3000

but both front/js/jsFiles and front/css/cssFiles exist.

Custom get action does not work

I'm trying to implement a custom action but it does not work.
My code:

exports.getSlug = function (req, res) {
  return req;
};

using this route http://localhost:3000/api/pages/slug?slug=mySlug

I got this error:

Possibly unhandled Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
  at new ObjectID (/projects/synthTest/back/node_modules/promised-mongo/node_modules/mongodb/node_modules/bson/lib/bson/objectid.js:35:11)
  at [object Object].ObjectID (/projects/synthTest/back/node_modules/promised-mongo/node_modules/mongodb/node_modules/bson/lib/bson/objectid.js:26:42)
  at exports.get (/projects/synthTest/back/resources/pages/getPage.js:47:17)
...

/synthTest/back/resources/pages/getPage.js:47 correspond to my get method:

exports.get = function (req, res) {
  return req.db.collection('pages').findOne({
    _id: req.db.ObjectId(req.params.id)
  }).then(function (page) {
    return page;
  });
};

That means synth didn't recognize my custom getSlug method using get instead and obviously slug?slug=mySlug isn't a valid _id

Seed data file

Consider adding a way simple way for seeding the database (or perhaps this exists and I simply don't know of it - I'm not very familiar with mongo yet), perhaps via a file that I can re-run to return the db to a good starting state.

Handle non-folders in back/resources

The lib/handlersParser.js should be able to handle non-folders in the resources folder better.

I got this error when a hidden OS X file sneaked it self into the folder:

Error: ENOTDIR, not a directory '/data/generator/back/resources/.DS_Store'
  at Object.fs.readdirSync (fs.js:654:18)
  at parseDir (/data/generator/back/node_modules/synth/lib/handlersParser.js:115:23)
  at /data/generator/back/node_modules/synth/lib/handlersParser.js:123:9
  at Array.forEach (native)
  at parseDir (/data/generator/back/node_modules/synth/lib/handlersParser.js:116:14)
  at Object.exports.parse (/data/generator/back/node_modules/synth/lib/handlersParser.js:127:5)
  at module.exports (/data/generator/back/node_modules/synth/synth.js:38:29)
  at Object.<anonymous> (/data/generator/back/back-app.js:27:18)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/data/generator/back/app.js:2:11)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)
  at startup (node.js:119:16)
  at node.js:902:3

Multiple Views

How can one have multiple views (index.jade, admin.jade) so as to separate all concerns say between the client facing module and the admin module

OpenShift

Hi,
I tried to upload my synthjs app (awesome framework, good job !) on OpenShift but i had to modify the command.js file in the synth module and add some lines in order to fix the problem and i was not supposed to theoretically.
synthjs_github_issue

Could you add an option for this case in a futur release ?

Thanks,

Yeoman generator

It would be great to have yeoman generator for synth.

Additionally to bootstrapping, you could even have it generate frontend and backend code if adding a new resource etc.

Or am I missing something the synth-cli does already?

Making Realtime with socket.io integration

Hi,
this is a really cool framework.i was wondering how easy it will be to integrate socket.io and have realtime feature . One could use the https://github.com/btford/angular-socket-io module on the clientside. my interest will be how to integrate socket.io server side and to the resource methods like you have with sails. I believe this will be better than sails with all that included

Update README

Update readme and source to samples and usage examples.
This project is intriguing; but worthless without solid examples and documentation.

Tutorial does not work

Several steps in the tutorial on your site mention files that do not exist:

my_app/front/controllers/tweetsController.js does not exist
my_app/front/js/controllers/tweets.js is what i found, is this correct?

I get an $http not defined when putting the suggested code there and attempting to use the form to make a post.

ReferenceError: $http is not defined
at Scope.$scope.publish (http://localhost:3000/js/controllers/tweets.js:6:5)
at http://localhost:3000/bower_components/angular/angular.js:10656:21
at http://localhost:3000/bower_components/angular/angular.js:18838:17
at Scope.$eval (http://localhost:3000/bower_components/angular/angular.js:12518:28)
at Scope.$apply (http://localhost:3000/bower_components/angular/angular.js:12616:23)
at HTMLButtonElement. (http://localhost:3000/bower_components/angular/angular.js:18837:21)
at http://localhost:3000/bower_components/angular/angular.js:2810:10
at Array.forEach (native)
at forEach (http://localhost:3000/bower_components/angular/angular.js:320:11)
at HTMLButtonElement.eventHandler (http://localhost:3000/bower_components/angular/angular.js:2809:5) angular.js:9899
(anonymous function) angular.js:9899
(anonymous function) angular.js:7246
Scope.$apply angular.js:12618
(anonymous function) angular.js:18837
(anonymous function) angular.js:2810
forEach angular.js:320
eventHandler

my_app/front/html/tweets/getIndex.html does not exist
my_app/front/html/tweets/getIndex.jade is there, is this the correct file?

I could not get my app to accept a post following the instructions in the tutorial. Forgive me if I am missing something, but I did try from scratch several times without success.

Error thrown by POST /api/tweets : Converting circular structure to JSON

I get this error even when posting a blank body, this should result in a 402 based on the example code right?

if (!req.body.content) return res.status(422);

Add nghtml2-js

Compress html2js , can reduce http request .

by the way : Can we write our own prod deploy script .

Set default resource

I'm trying to have synth returning a default resource.

The following code in the back/back-app.js works, is there a better way to do it?

/**
 * Array of available resources.
 * Those resource names should not be used as url slugs for pages.
 *
 * @type {string[]}
 */
var availableResources = ['categories', 'pages'];

var defaultPage = 'home';

/**
 * Return an array of path parts.
 * It removes the first part of the array if it's empty.
 *
 * @param {string} path
 * @returns {Array}
 */
var getPathTokens = function (path) {
  /**
   * Array of url path parts.
   *
   * For a path like `/` it returns an array
   * of two empty strings.
   *
   * For a path like `/my-slug` it returns an array
   * of two strings: ['', 'my-slug']
   *
   * @type {Array}
   */
  var pathTokens = path.split('/');

  if (pathTokens[0] === '') {
    pathTokens = pathTokens.splice(1);
  }

  return pathTokens;
};

synth.app.use(function (req, res, next) {

  var currentPathTokens = getPathTokens(req.originalUrl);

  /**
   * If `currentPathTokens` contains only one element
   * and this element is not one of the available resources
   * it assumes it's a page slug and change the route to point
   * to `/page/slug-name`.
   *
   * If `currentPathTokens[0]` is empty it routes to the default one.
   */
  if (currentPathTokens.length === 1
    && currentPathTokens[0].indexOf(availableResources) === -1) {
    req.url = '/pages/' + (currentPathTokens[0] || defaultPage);
  }

  next();
});

Support back-app.coffee

I tried to convert back-app.js into back-app.coffee, but the latter does not seem to be recognized by Synth:

[root@alexey hacc2]# synth s
...
Error: Cannot find module '/root/hacc2/back/back-app.js'

However, Coffeescript is supported in all other locations. So, it would be nice to support it here as well...

Getting error as angular not defined

I have installed Synth on OSX Meverics, I am able to launch the application, as output I am able to view a blank page showing text 'Synth app', and in the browser console I am able to see below exception.

Uncaught ReferenceError: angular is not defined

I have checked the jsfiles.json files the angular module is defined at the top before any JS files.

Default error handling on resources.

I really like the promise way defining the resources in the backend.

However, the server will never send a response, if there is an unhandled exception.

I add this to the end of all my promise-chains in the

.fail(function (err) {
    res.status(400);
    console.log('err', err);
    return err.message;
});

I think this could be added in the added by default in
synth/lib/handlersParsers.js
probably in the func function. Have not looked to much at it yet.

I don't know if its good practise to throw the error message directly back in a production environment. So in production it is probably better to do something like

.fail(function (err) {
    res.status(400);
    console.log('err', err);
    return 'An error occured';
});

Use Yeoman for project generation

Move the templates from this project into a yeoman generator. Then allow the synth binary to query yeoman for the various synth generators and execute them.

Front End Directory layout and more

Hi!
I have been looking at Synth and I think it's awesome, the Back End side is pretty neat and simple, in fact you read my mind because I was planning to work on something similar.

There are a couple of things that I think that Synth needs to improve in order to live up to its potential, in particular, things related to the Front End, in order of importance:

1. Proper Angular.js Directory Layout

There has been a lot of discussions about Angular.js Directory Layout, in fact the Phone Cat official Angular.js tutorial uses the current Synth Angular directory structure, but the reality is that when working with non-trivial Angular apps this layout becomes obtrusive and just messy.

That's why a lot of smart people, even the Angular Guys, have been proposing alternative layouts that are module oriented instead of abstraction oriented:

My experience with Angular.js supports the Module Oriented directory structure, it fits better with the way of thinking and creating apps and it encourages better practices.

I think that Synth should go for this structure instead of the current abstraction-oriented layout.

Corolari: Implementing this structure will probably need Synth to integrate a more complex build system for which I encourage Browserify, I also can provide help with it.

2. Template Cache instead of Script tags

Angular.js has a built in mechanism to solve the Template Caching that currently Synth is solving with the <script id='path/to/template.html' type="text/ng-template">, which is more sophisticated and less obtrusive to the HTML document: enter Template Cache.

There are, also, components for both Grunt and Gulp that automate this process:

Please note that this are not the only ones, just the first that Google showed, but they do work seamlessly.

3. Preloaded Data should not be a Global Variable.

I think that the Preloaded Data is a great Idea, but I think it should not be a Global Variable, for starters it's really obtrusive for the HTML when you have a lot of data and it feels like Synth is getting a side track to implement this.

I believe there is a better way of solving this: Angular Service:

//common/preloadedData/preloadedData.js
angular.module('synth.preloadedData', [])

.factory('PreloadedDataService', function () {

  var preloadedData = { ... filled in the server ...};

  return preloadedData;
});

In this way you are not going Around angular in order to get this feature done.

4. Test integration by Default

I know this has its complexities to implement, but I strongly believe that Synth should come right out of the Box with testing in mind, it should have at least Front End and Back End test boilerplate and opinions about it. And if you are as crazy as I am with testing Synth you have Integration testing and High level testing with it, the Angular.js default is Protractor.

Other notes

I think that in some point Synth is going to need some type of Build System to delegate all the task that regularly needs to do, for which I strongly suggest Gulp instead of Grunt. And this are my personal reasons, but there are a lot more out there:

  • Gulp.js is faster (it uses memory instead of disk as intermediate storage, which is Grunt behavior)
  • Gulp.js tasks are easier to create and maintain: When the tasks get complicated the Gruntfile can become a real mess and a pain to maintain.
  • Gulp.js feels more natural, and has more relation with Make than Grunt.

End

Synth has a lot of potential, and I'd be glad to submit pull requests implementing this in my spare time, I'd like your feedback, let me know what you think!

Fran

Add a `synth routes` command

It'd be helpful to see what API and view endpoints have been auto-generated. Would work similar to Rails' rake routes command.

Back end routing issue?

Hi. When I create a route with angular, ex: /posts/add and click on a link in front end, I see the defined template and everything works. But when I refresh the same page, Synth tells me "Cannot GET /posts/add". What should I do so that route would work also when refreshing the browser? I tried to add /back/resources/posts/add/getAdd.js with content
exports.getPostsAdd = function (req, res) {
};
but it does not work. Help please.

html as rendering for index page

Hi Jon, is it possible to use plain html in place of index.jade or in place of any rendering engine at all. and how would one go about that if possible.
Thanks a lot

Hosting in Node.js cloud

Hi Jon ,
I want to host the test project am working on using synth, on openshift which requires a package.json file in the root with the main js file (usually app.js) specified. How do i go about this with synth.
Thanks a lot

Dependency warnings on 'synth install -b', leading to failure of 'synth server'

ColinMacbook% synth install -b
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/jade requires mkdirp@'~0.3.5' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/mkdirp,
npm WARN unmet dependency which is version 0.5.0
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/bower requires mkdirp@'~0.3.5' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/mkdirp,
npm WARN unmet dependency which is version 0.5.0
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/npm requires mkdirp@'~0.3.5' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/mkdirp,
npm WARN unmet dependency which is version 0.5.0
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/npm requires nopt@'~3.0.0' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/nopt,
npm WARN unmet dependency which is version 2.2.1
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/uglify-js requires optimist@'~0.3.5' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/optimist,
npm WARN unmet dependency which is version 0.6.1
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/coffee-script requires mkdirp@'~0.3.5' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/mkdirp,
npm WARN unmet dependency which is version 0.5.0
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/node-sass requires mkdirp@'0.3.x' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/mkdirp,
npm WARN unmet dependency which is version 0.5.0
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/stylus requires mkdirp@'0.3.x' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/mkdirp,
npm WARN unmet dependency which is version 0.5.0
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/harp/node_modules/terraform requires jade@'0.35.0' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/jade,
npm WARN unmet dependency which is version 1.3.1
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/harp/node_modules/terraform requires coffee-script@'1.6.3' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/coffee-script,
npm WARN unmet dependency which is version 1.7.1
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/harp/node_modules/terraform requires stylus@'0.40.0' but will load
npm WARN unmet dependency /srv/www/development/synth_app/back/node_modules/synth/node_modules/stylus,
npm WARN unmet dependency which is version 0.45.1
[]
ColinMacbook% node -v
v0.10.28
ColinMacbook% npm -v
1.4.9

Default error handling on resources.

I really like the promise way defining the resources in the backend.

However, the server will never send a response, if there is an unhandled exception.

I add this to the end of all my promise-chains in the

.fail(function (err) {
    res.status(400);
    console.log('err', err);
    return err.message;
});

I think this could be added in the added by default in
synth/lib/handlersParsers.js
probably in the func function. Have not looked to much at it yet.

I don't know if its good practise to throw the error message directly back in a production environment. So in production it is probably better to do something like

.fail(function (err) {
    res.status(400);
    console.log('err', err);
    return 'An error occured';
});

Support node debug mode

It would be great if the synth cli supported the node debug flags like so:

synth s --debug
and
synth s --debug-brk

So I can debug using e.g. node-inspector

non-Jade templates

For me synth looks like a great framework, but in all my node.js projects I am using EJS instead of Jade.

So it would be great to have a possibility to use EJS. Is it possible?

Actually this also applies for LessCSS instead SASS, but if I can live with SASS for CSS, as it looks not so different, but EJS is completely different.

Problem while installing at Windows 8.1

Hello! I'm having problems while I'm trying to install Synth at my dev machine, which is running Windows 8.1.
Node installation is running fine, but when I use the npm install -g synth I get a lot of errors.

synth install -f throws error

$» synth install -f                                                                                                                                                                                                    

/usr/local/lib/node_modules/synth/node_modules/bower/node_modules/q/q.js:126
                    throw e;
                          ^
angular: Unable to find suitable version for angular
    at createError (/usr/local/lib/node_modules/synth/node_modules/bower/lib/util/createError.js:4:15)
    at Manager._electSuitable (/usr/local/lib/node_modules/synth/node_modules/bower/lib/core/Manager.js:716:15)
    at /usr/local/lib/node_modules/synth/node_modules/bower/lib/core/Manager.js:514:25
    at _fulfilled (/usr/local/lib/node_modules/synth/node_modules/bower/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/synth/node_modules/bower/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/synth/node_modules/bower/node_modules/q/q.js:760:13)
    at /usr/local/lib/node_modules/synth/node_modules/bower/node_modules/q/q.js:526:49
    at flush (/usr/local/lib/node_modules/synth/node_modules/bower/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)

lThis is my bower.json file:

{
  "name": "test-app",
  "private": true,
  "dependencies": {
    "angular": "~1.2.19",
    "angular-route": "~1.2.14"
  }
}

Resource Endpoints must take both req, res

I am not sure this is intended or not.

But I removed the res parameter from my endpoint definition as I don't use it:

exports.get = function (req) {
    return req.db.collection('user')
        .findOne({
            _id: req.db.ObjectId(req.params.id)
        }, {
            password: 0
        });
};

Note: Everything works as expected when i add the res parameter again.

Howerver, It seems like the parseFile is actually calling the get function from my endpoint definition as I got this error:

/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/resources/user/crud.js:125
    return req.db.collection('user')
                  ^
TypeError: Cannot call method 'collection' of undefined
  at exports.getIndex (/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/resources/user/crud.js:125:19)
  at parseFile (/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/node_modules/synth/node_modules/synth-api/lib/handlersParser.js:112:14)
  at /Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/node_modules/synth/node_modules/synth-api/lib/handlersParser.js:147:11
  at Array.forEach (native)
  at parseDir (/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/node_modules/synth/node_modules/synth-api/lib/handlersParser.js:144:14)
  at /Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/node_modules/synth/node_modules/synth-api/lib/handlersParser.js:151:9
  at Array.forEach (native)
  at parseDir (/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/node_modules/synth/node_modules/synth-api/lib/handlersParser.js:144:14)
  at Object.exports.parse (/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/node_modules/synth/node_modules/synth-api/lib/handlersParser.js:155:5)
  at Object.exports.generateHandlers (/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/node_modules/synth/node_modules/synth-api/main.js:14:33)
  at module.exports (/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/node_modules/synth/synth.js:40:27)
  at Object.<anonymous> (/Users/mmoller/litepoint/svn/IQramp/Source/trunk/server/ramp-server/back/back-app.js:13:18)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/usr/local/lib/node_modules/synth/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at requireUncached (/usr/local/lib/node_modules/synth/lib/requireUncached.js:18:10)
  at startServer (/usr/local/lib/node_modules/synth/lib/commands.js:65:15)
  at Object.exports.startServer (/usr/local/lib/node_modules/synth/lib/commands.js:94:5)
  at Object.<anonymous> (/usr/local/lib/node_modules/synth/bin/synth:64:12)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)
  at startup (node.js:119:16)
  at node.js:906:3

Is this supposed to work this way?

Catch and show jade render errors of views

Right now if a jade template has an error during the prefetch phase, it crashes the server with a not so useful error.

Instead, the server should just log the error, and show the error to the user in dev mode, and a generic error in prod mode.

Access the "server" var in back-app.js

Hi,
I would like to integrate the new socket.io 1.0 version into my synth app.

It is usually done this way :

var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server);
...
server.listen(80);

or

var app = require('express').createServer();
var io = require('socket.io')(app);
...
app.listen(80);

or again

var app = require('http').createServer(handler)
var io = require('socket.io')(app);
...
app.listen(80);

source : http://socket.io/docs/

One interresting thing is that socket.io is listening to the server so it can automatically serve the client file via :

http://localhost:<port>/socket.io/socket.io.js

But I can't find where to attach that server, there is no variable as "app" or "server" in the back-app.js file.
I tried with synth, synth() and synth.app but it didn't seem to work.

Thanks !

Initial Feedback

I can create separate issues for each of these, if that's easier. This is just me getting the install process completed. I plan to add more to this issue as I use synth more.

  • Before install instructions, might be worth including a reminder to update npm & node. I got an error on my first attempt to install synth that was fixed after updating
  • Consider adding more details to what happens when I run "synth new" (e.g. which directories were created, files generated)
  • Is there a situation in which I don't want to run install -f & install -g right after new? If not, consider running those by default
  • I got the following error after running git add . after running synth install -b:
~/my_project (master)!» git add .
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/harp/node_modules/terraform/node_modules/jade/node_modules/constantinople/.gitattributes.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/harp/node_modules/terraform/node_modules/jade/node_modules/constantinople/.npmignore.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/harp/node_modules/terraform/node_modules/jade/node_modules/constantinople/.travis.yml.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/harp/node_modules/terraform/node_modules/jade/node_modules/constantinople/LICENSE.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/harp/node_modules/terraform/node_modules/jade/node_modules/constantinople/README.md.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/harp/node_modules/terraform/node_modules/jade/node_modules/constantinople/index.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/harp/node_modules/terraform/node_modules/jade/node_modules/constantinople/test/index.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/jade/node_modules/constantinople/.gitattributes.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/jade/node_modules/constantinople/.npmignore.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/jade/node_modules/constantinople/.travis.yml.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/jade/node_modules/constantinople/LICENSE.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/jade/node_modules/constantinople/README.md.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/jade/node_modules/constantinople/index.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in back/node_modules/synth/node_modules/jade/node_modules/constantinople/test/index.js.
The file will have its original line endings in your working directory.
  • synth install -b installs a crazy amount of stuff. Is this count right?
find back/ -type f | wc -l
> 10524

...to be continued as I use synth more

pre-render server side for SEO

For SEO It would be very nice if we Synth could (optionally) pre-render the HTML on the server side and that when the frontend is up&running angular takes over again

Combine Synth with another project

Hi Jon,

I don't have your personal contact info so I'm doing this this way.

Synth has some cool features. The trouble is that when someone chooses to use it for their project they miss out on the different cool features of alternatives. Unfortunately, they can only use one thing to start their project.

As far as I can tell, the top cool features of Synth are

  1. Preloading data
  2. Works with any JS framework

I think Preloading data could be added to another project. It might be the case that the second thing, Working with any JS framework, can't.

So, is the value of that benefit more than the value of what you miss out by not using any of the alternatives?

To help answer that question, I made this spreadsheet. It has separate sheets for comparisons between Synth and the top other generators. There's also a sheet with my thoughts about why we need to reduce the number of alternatives.

The spreadsheet attempts to give values to each benefit, so the whole generators can be compared. The lists of what benefits each one has are objective, but the importance weights are naturally subjective. Take them for what they are worth.

It makes sense for Synth to exist as a distinct generator under two conditions:

  1. The benefits of Synth cannot be integrated into another project
  2. For any project, one's personal value of the Synth benefits outweigh those of alternatives. For example, the work involved and performance cost in not using Backbone is more than the work involved in re-implementing everything Synth doesn't do that another generator does.

If (2) is never the case, then it will only make sense to keep Synth as a separate project if enough benefit is added to it to make it the case. That seems like it would be a lot of work, but I don't know.

So two questions:

  1. Can the distinct benefits of Synth be integrated into another project?
  2. For any project is the sum value of Synth's distinct benefits greater than the sum value of the distinct benefits of each other generator?

To me, the idea of adding JS framework flexibility to the richest generator makes more sense in the same way that inheritance in object oriented programming makes sense - you only need to make the differences and you get what's common for free. What do you think?

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.