我的代码有些东西不能很好地工作。我刚刚开始使用第一行代码并安装软件包。这是代码:
服务器.coffee
require 'coffee-script'
express = require 'express'
app = express()
app.get '/', (req, res) ->
res.send "Hello from express"
app.listen(3000)
console.log "Server is listening"
index.eco
<!DOCTYPE html>
<html lang="end">
<head>
<title>Our Page</title>
<body>
<h1>Our Index</h1>
</body>
</head>
</html>
首先,我不得不说,当我尝试更改代码时,express.createServer()
已经更改为express()
res.send "Hello from express"
至
res.render 'index.eco', layout: false
运行服务器后它不起作用。有任何想法吗?
包.json
{
"name": "coderacer",
"version": "0.0.0",
"description": "Example",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ro",
"license": "BSD-2-Clause",
"dependencies": {
"coffee-script": "*",
"express": "*",
"eco": "*"
}
}