J
J
Jiakki-js2015-05-05 12:58:55
JavaScript
Jiakki-js, 2015-05-05 12:58:55

Coffeescript in expressjs app!?

9f2ac2c3eee3469db4d6b75e6308ab60.jpg
Where is the right place to put *.coffee files that are translated into *.js ?
What is a convenient application structure so as not to get confused in the future?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Shikanov, 2015-05-05
@Jiakki-js

For files that work on the server, there is no need to translate them into js manually at all, node.js can do it itself. All you need to do to run the application is something like this file:

#!/usr/bin/env node
CoffeeScript = require("coffee-script");
CoffeeScript.register();

create_app = require("../app/application");
app = create_app();
app.listen(5000);
console.log("Application running on http://localhost:5000/");
console.log("(" + process.env.NODE_ENV + " mode)");

where ../app/application is application.coffee, then you can work in coffee files as well as js, when connecting modules, you do not need to specify the .coffee extension

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question