Comments (17)
Hey @djrenren, you should be able to use the express response directly for that. More here: http://expressjs.com/api.html#res.send. Is that what you're looking to do?
from kraken-js.
Ah, you don't even want one configured and ignored?
from kraken-js.
Like a web server. Cool request. Is there a reason you cant use vanilla express, maybe something else in kraken that you'd like to make use i guess.
from kraken-js.
@totherik - Correct, currently my project has to list dustjs-linkedin
, dustjs-helpers
, and adaro
as dependencies otherwise I encounter startup failures. I'd like to get rid of this need.
@pvenkatakrishnan - I really like the lifecycle options as well as the structure for controllers and configuration. It makes working with a team a lot more convenient.
from kraken-js.
FIxed with PR #61
from kraken-js.
It appears that after the kraken.next (#114) code was merged in that the ability to opt out of a view engine is no longer available. Even the documentation on how to opt out of the view rendering (#72) is missing from the README.
Did this issue regress or maybe there's a better way to handle this now that hasn't been documented?
from kraken-js.
Hey @poorgeek, actually, unless you use the generator no view engine is configured by default, e.g. when you res.render
you get this:
Error: No default engine was specified and no extension was provided.
and with the generator you can simply choose 'None' at the template library question and express will not be configured with a view engine.
Express settings are documented here.
from kraken-js.
@totherik I know this isn't the best place to figure this out, but I'm getting the "No default engine" error even though I've made sure that my generated app has all of the proper configs that are in an app generated with the 1.1.0 generator. I'm also not calling res.render
anywhere in the app since I'm using kraken to build out an api which is rendering all of the responses to json. This is why I'm wondering if there's a regression happening.
from kraken-js.
Interesting. I'm not completely familiar with what the 1.1.0 version of the generator creates by default, but do you have expressView
, fileNotFound
, and serverError
middleware configured in config/app.json
? expressView should be a noop if you have nothing enabled, but the error handling middleware assume a renderer, I believe. If you have them can you try removing them? You'll also probably want to remove devtools
from config/development.json
as it's mainly intended for UI artifacts. Let me know what you find.
from kraken-js.
is it possible for us to take a look at it on github somewhere ? I used the latest generator to create a sample without view engines...
I had to remove the res.render from the default controller (which could be pre generated to not do that), but once i changed that, it worked fine.
https://github.com/pvenkatakrishnan/Kraken-NoViewEngine
from kraken-js.
I agree there can be a few modifications done when no view engine is selected which i will file as an issue against the generator.
from kraken-js.
Looks like there is already one krakenjs/generator-kraken#115
from kraken-js.
@pvenkatakrishnan I actually generated a NoView and a View project (using the generators defaults) and diff'd the two projects just to see what was different. I then diff'd the NoView project with my project and found that we were using an older version of engine-munger
(0.1.3) and that we were missing the expressView middleware from our config.json
. We are using the devtools, but only in our config/development.json
(which was generated), though I'm not testing against that env.
My theory is that when something goes wrong in the code that throws an error condition (404, 500, etc..) that express is still trying to render a view even though its been configured not to display views. So maybe I'm missing a configuration somewhere that should be returning a json response instead.
from kraken-js.
ahhh gotcha. Let me generate a 500 error to see what happens....
from kraken-js.
You were right, by default the config was still trying to render 500 and 404 views provided within the kraken-js module (which need to be changed in the generator as well). but once i added customized error handling, it worked....
Check this out... https://github.com/pvenkatakrishnan/Kraken-NoViewEngine/blob/master/config/config.json#L29
from kraken-js.
Capturing these concerns in krakenjs/generator-kraken#115.
from kraken-js.
@pvenkatakrishnan that got it! Thank you!
from kraken-js.
Related Issues (20)
- How to access image from directory located outside the workspace? HOT 1
- Uglify-js has security issues HOT 1
- Templates in public directory? HOT 2
- remove bluebird 🔥 HOT 5
- Support Async Middleware HOT 6
- Is it alive? HOT 3
- remove domains? HOT 16
- formidable events not firing properly in kraken HOT 1
- Koa port HOT 1
- Ajax with krakenjs HOT 1
- Upload multiple images krakenjs using ajax HOT 1
- Creating New Project using yo for Ubuntu 16.04 HOT 6
- Server is starting (status 503) HOT 3
- Dead? HOT 6
- Add node 12 in travis CI
- [Devdeps][security] replace jade with pug
- Yo Kraken Error HOT 9
- Kraken.js - yo kraken Error kraken primordials is not defined HOT 3
- Name of this library HOT 1
- Feature request: ability to use `config/*.js` instead of json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kraken-js.