I want to understand how jhipster generator generate the code and how it works ?
https://github.com/jhipster/generator-jhipster
JHipster is a nodejs program that uses yeoman scaffolding system.
Related
Can i use javascript instead of typescript in Jhipster tool .I have set the environment and project structure where I found typescript is being used as a file for react side , so my qus is can we have a project skeleton of javascript instead of typescript.pls respond?
You can't configure JHipster to generate frontend code in Javascript.
If you are ok with using an old version of JHipster (and Angular instead of React), JHipster 4 can generate your client-side using AngularJS.
Install the latest version 4.x locally:
npm i generator-jhipster#4.14.5
Create an application:
jhipster
When prompted about the frontend framework, choose AngularJS:
? Which *Framework* would you like to use for the client?
Angular 5
> AngularJS 1.x
If you must absolutely use javascript, I think this is the easiest way.
I'm trying to create an Angular2 project with a REST service, using NodeJs. Although I found some tutorials/sample codes doing this kind of applications, the organization of the code/project is different form each other. I'm trying to figure out what's the best way so far to do that.
Basically,
what is the best approach to creating Angular2 project with NodeJs back end?
what should be the folder structure?
where to put the Angular code(with TypeScript)?
how to use Bower/Gulp?
A sample of Angular2 + NodeJS and a few other things: http://thejackalofjavascript.com/developing-a-mean-app-with-angular-2-0/
You can use Angular-Cli to create the initial project structure: https://github.com/angular/angular-cli
Gulp tutorial: https://scotch.io/tutorials/automate-your-tasks-easily-with-gulp-js
I do not recommend using bower. Use npm instead, as it is more stable, and has more support from the tools.
I am currently working on two related projects. One is a Phoenix based website and API, while the other is an Angular2 application that among other things uses the API provided by Phoenix. I now want the Angular2 application to be used by the Phoenix project. The problem is that I don't know what the best approach is. I am very new to Angular2 and NPM, and know very little of how it actually works outside of basic usage. These are the ways I can think of solving my problem:
Put the Angular2 project into the Phoenix project, making it one project. I have no idea how to do this, but I will probably get there through trial and error as both use Node.js so it should be doable.
Publish the Angular2 project to NPM, and then import it to the Phoenix project. How much work would be needed on the Phoenix side? Would it be the same as just running the index.html in the Angular2 project? Would I need some kind of Angular2 "shell" around it?
Run the Angular2 application as it's own thing, and just link to it through the Phoenix website.
Importing it as a node module sounds like the best approach, but can it be done for full applications, or is it intended for support libraries only?
I am unsure if this is the "right" way to do it but this is what I did in the end:
I compiled my entire Angular2 project into app.js, vendor.js, and common.js, I then moved it all to web/assets/. After that I simply created a new html and referenced the files in question.
The biggest challenged was finding something to compile it all into these 3 files. I ended up using a stripped down version of: https://github.com/AngularClass/angular2-webpack-starter
I think you would want to leverage brunch.io, which ships with phoenix to handle your front end dependencies. There are skeletons which are essentially templates that create different front end configs but I don't see one that provides angular2. In this case I would say use bower to install the js packages you want ie:
bower install -S angular2
With this you can use brunch as a processing pipeline and it will handle minification, linting etc. and you will still be working within the "recommended" approach to managing front end assets in Phoenix.
I'm wrapping my head around creating a Yeoman generator, so that Yeoman can generate our boilerplate whenever a new project is started.
The building blocks of this boilerplate should be version controlled. So I assume the generator (which will contain the rules for creating the boilerplate) should be hosted on github.
Which leads me to the question: if the generator itself is hosted on github, how will Yeoman save me any time? Because in order to use the latest version of the generator I would have to pull it off off github anyhow (which I could just as well do with the boilerplate itself, if it were hosted on github).
Or am I misunderstanding where a Yeoman generator is located? Because as I understand it you have to have it locally, or use one of the generators from the public repo.
You can quite easily publish it to npm using the command npm publish. Then you can install and upgrade it just like any other npm module. I did it myself for my first Yeoman generator and it's pretty straightforward.
This is a good place to start.
Is there a way to create a crud scaffold by using the schema model used?
Must not be a framework, more of a utility.
Currently using:
ExpressJS
MongooseJS
MongoDB
I guess you could try to use RailwayJS? It has an example as well for setting up a CRUD scaffold:
railway init blog && cd blog
npm install -l
railway generate crud post title content
railway server 8888
open http://127.0.0.1:8888/posts
EDIT
There are a couple of alternatives, but I think Railway is your best bet, unless I misunderstand your question. You could implement something yourself, as was already suggested. For more on these alternatives, see these StackOverflow questions (you are not the first to ask this):
Is there a CRUD generator for Mongoose and Node.js and Underscore? Or a CRUD generator for a similar stack?
CRUD module or tutorial for node.js
I created bumm, a command line tool for generating express project skeletons and scafflod models/routes/views that could fit your needs. The view generation is not exactly what you might want since bumm does not parse an existing model but expects the model fields to be passed as command line parameters. But it's open source...
I'm using MEANJS (www.meanjs.org) and it has a yeoman generator which doesn't only generate the seed app, but can generate a module for you which includes mongoose models, expressjs routes and controllers and the same for angular for a crud, but you can't specify the fields (got to code those in after the generator does the plumbing for you).
I would love to see them expand it to some generator where I can specify the fields and their type.
Assuming you already have node and npm installed
npm install -g express
npm install -g express-generator
Then use express to scaffold a webapp
express "app name"
I created a short tool for this purpose recently, CRUD scaffolder. It's not much, it has some problems, but it helped me start faster with some projects at the time.
I like these words:
Must not be a framework, more of a utility.
Have you tried amur?
It's a utility for generating koa+mongoose+graphql API resources.