How to include Cesium in existing Node.js project?

Hello all!

I have Node.js project and I want to include Cesium into it on front-end. I've read https://cesiumjs.org/tutorials/cesium-up-and-running/ and first downloaded archieve http://cesiumjs.org/downloads.html from here. But there a lot of data that is unnecessary for my project. I copied Cesium and CesiumUnminified to my public directory which is available for browser and was able to create a map (tested minified and not minified versions).
My project has next structure http://screencast.com/t/pz49fpLEpwC . "npm install cesium" installs it to node_modules folder which is not available for browser.
How can I allow access to cesium project without copying to public directory?

The simples way is to do this:
app.use(express.static(path.join(__dirname, '/node_modules/cesium/Build')));

that was taken from here:
Serve static files from multiple directories, but give precedence to “./public” over the others:

app.use(express.static(__dirname + '/public'));
app.use(express.static(__dirname + '/files'));
app.use(express.static(__dirname + '/uploads'));

http://expressjs.com/en/4x/api.html#app.use

Yeah, that’s roughly the approach I took in the sample project I just published. I also did some work to handle bundling with Webpack. See the link over in https://groups.google.com/forum/#!topic/cesium-dev/Ay7fbqDxyqw for more info.

Mark Erikson

I build a yeoman generator that integrates cesium into an expressjs app:

Thanks for sharing James! If you haven’t already, tweet it at CesiumJS (https://twitter.com/cesiumjs) and I’m sure you’ll get a retweet for some extra visibility.