Nodeclipse / nodeclipse

Nodeclipse-1 : Eclipse plugin for Node.js, PhantomJS development (Nodeclipse core plugin); Maven and Gradle (with Android) plugins
https://nodeclipse.github.io/
158 stars 76 forks source link

MEAN stack template #175

Open paulvi opened 10 years ago

paulvi commented 10 years ago

@nodeleaf Patrick

I want to add template to quickly create MEAN app (inside New Node.js Project Wizard)

Please guide me quick. I need simple minimun set of files, like I did for Angular
see https://github.com/Nodeclipse/nodeclipse-1/tree/master/org.nodeclipse.ui/templates/hello-angularjs

ghost commented 10 years ago

There is two very different options here. What's common in both cases is a node/express app with mongodb (mongoose recommanded) data storage. It could use a jade like template engine with some levels of interactive angularjs components. Or provide a REST API to be used from a plain angularjs application. My own practice is using both actually: a public site using first case and a private admin using the latter. My point here is: I am not sure my own practice could be reduced to a simple template files set without compromising the flexibility that's inherent to the MEAN stack but we could try...

paulvi commented 10 years ago

Personally, I think mixing client-side and server side processing is not good. And especially for an example.

Do you think hello-angularjs could be good base for MEAN template?

ghost commented 10 years ago

Do you think hello-angularjs could be good base for MEAN tamplate?

Depends on where this "base" will lead you.

You could also start from existing hello-express 4 project template, adding mongodb data storage (step 1: a node/mongodb template) then adding angularjs front end (step 2: a MEAN stack template) but it won't make much sense if it doesn't use mongodb for real - does it?

Something simple enough it could do is to extend the data dynamic binding shown here: http://nodeleaf.net/angularjs-eclipse-plugin/ - running on a node/express app (instead of apache2) and storing the user inputs as new documents into a mongodb collection on localhost? And if the template script could handle this the target collection would be capped so it won't grow infinitely...

paulvi commented 9 years ago

I though maybe just package.json with all dependencies could be enough

ghost commented 9 years ago

A package.json file will do for the back-end side of the MEAN stack: the front end being an angularjs app connecting to the back end calling a restfull API - it will not be "visible" in package.json .

A typical one below - assuming we first create an express project in Nodeclipse:

{
  "name": "meanstack",
  "version": "0.0.0",
  "private": true,
  "description": "Boilerplate mean stack project",
  "main": "app.js",
  "scripts": {
    "start": "node ./bin/www",
    "test": "echo \"Error: no test specified! Configure in package.json\" && exit 1",
  },
  "author": "",
  "license": "",
  "dependencies": {
    "express": "latest",
    "express-session": "latest",
    "body-parser": "latest",
    "cookie-parser": "latest",
    "serve-favicon": "latest",
    "morgan": "latest",
    "mongoose": "latest",
    "jade": "latest"
  }
}

I set all dependencies version above to "latest" as we don't know when it will be used but it's always possible to retrieve a given package current version like this:

$ npm show PACKAGE_NAME version

paulvi commented 9 years ago

Using latest will make project vulnerable if some API changes in future.

Usually package.json has specific version,
that can be updated with npm install --save