1

I used mimosa to generate an express app, and work with it using mimosa watch --server. Everything is great.

There is a server.coffee file, autogenerated by mimosa and requirejs compliant, that contains the line exports.startServer = function(config) { ... }

How do I start that through the command line? I try coffee server.coffee, sometimes with an -r.

Thanks!

OMGoodness, forgot to mention I am on Windows. Everything else has worked the same as any examples I find on the internet (NPM wasn't installing well 6 months ago, but things are really good lately).

Node v 0.8.14 coffee 1.4.0 mimosa 0.6.1

Mimosa says it runs startServer from server.coffee. What is the equivalent from a command line considering requirejs format of server.coffee?

danb
  • 10,239
  • 14
  • 60
  • 76
Jim Mack
  • 1,437
  • 11
  • 16
  • "I try `coffee server.coffee`" What happens instead of what you expect? – Alex Wayne Dec 21 '12 at 01:26
  • It just returns. Cofffe -r server.coffee does this: – Jim Mack Dec 21 '12 at 02:01
  • module.js:340 throw err; ^ Error: Cannot find module 'server.coffee' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:362:17) at require (module.js:378:17) at loadRequires (C:\Users\Jim\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:242:7) at Object.exports.run (C:\Users\Jim\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:64:7) at Object. – Jim Mack Dec 21 '12 at 02:06
  • (C:\Users\Jim\AppData\Roaming\npm\node_modules\coffee-script\bin\coffee:7:41) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) – Jim Mack Dec 21 '12 at 02:06

1 Answers1

2

Mimosa author here. Sorry I didn't notice this sooner! You are always welcome to come to the Google Group to ask questions: https://groups.google.com/forum/#!forum/mimosajs That'll get noticed right away!

coffee server.coffee isn't what you should be executing.

Once you've run mimosa new, the project you are delivered it started by executing mimosa watch -s. That starts the watching of the file system, builds all the files, and then starts the server by calling the startServer method of your server file.

David Bashford
  • 605
  • 4
  • 6
  • David,Thanks for your great work. I do what you suggest for dev. I'm more asking about deployment. I finally found your deploy addon library which is working fine. https://github.com/dbashford/mimosa-web-package. I was the guy with problems crossing win/unix configurations, whom you tried to help Christmas eve or something! This reminds me I need to discover what you asked me then, rather than continuing the kludge I use. – Jim Mack Feb 04 '13 at 18:52
  • Ah, yeah, sorry, the web-package module was made just to handle the "I want to deploy this app, now what?" question. Because `server.coffee` needs to export a hook for Mimosa to call into, it means the server is started via a function call rather than just being required in. So when you just type `coffee server.coffee` you aren't calling that function. All web-package does is give you an additional piece of code that imports your server and calls that function. I was definitely keen to provide some means to use a fully built Mimosa app without using Mimosa. Glad it is working for you!! – David Bashford Feb 04 '13 at 22:35