Andna
Andna

Reputation: 6689

Yeoman application - using custom nodejs server

I am starting a development of node.js & anular application using Yeoman tool for all its awesomeness (or so they say) but I am wondering about one thing.

After my application is generated there are some task defined for grunt, for example server which I can start to serve my application.

Everything looks fine if I would want only client-side of the application to be developed but what about integrating some custom node.js server file that would contain some server-side logic if I would want to develop web-application using full javascript stack?

What is the best way to integrate custom node.js server into Yeoman managed application? (I generated mine using angular generator)

Upvotes: 0

Views: 794

Answers (1)

Ted Johnson
Ted Johnson

Reputation: 4343

Here is some quick research I have done and what I would do. I would integrate yeoman/grunt with Express a Connect/Node.js based application server. Hey I think grunt server etc even comes with it! They you have reference static content and dynamic serverside app type stuff quite easily. Example, junk code:

app = require('express').express();
app.use('/', connect.compress());
app.use('/', express.static('static/root'));
app.use('/urlfornodestuff', YOURFANCYAPP);

Start here as part 2 talks about how to do this: http://arvelocity.com/2013/05/04/running-an-express-server-with-grunt-and-yeoman-part-1/

In part 2:

Now your Express server is running from server.js with a minimalistic client-side app, and with tests! Expand on it to your heart’s content and watch happiness spread out across the land.

Upvotes: 1

Related Questions