node.js - 'nodejs web.js' works, 'foreman start' doesn't -


I am developing a website that I want to deploy on local people / cute / AOS

< P> Local people and AOS, when 'Node's Web JS 'port calls to 3000 works,

While giving 'foreman start' this ports give feedback to 3000, but the browser does not show the site.

Note: '/ Public' Dyare was replaced with 'assets'.

web.js

  var http = require ("http"), // path path path // utilities ("(" ("(Fs"), extension = {".html": "text / html", ".css": "text / css", ".js" to access the file system "Image / jpeg", ".tf": "font / truetype": "image / png", ".gif": "image / gif": "image / gp", ".jpg" , ".jpg", ".otf": "font / opentype", ".woff": "application / x-font-woff"}; Http.createServer (function (req, res) {// URL in one file Look for the name, default for index.html var filename = path.basename (req.url) || "index.html", ext = path.extname (filename), dir = path.dirname (req.url). Substring (1), // __dirname one end The built-in variable is where the path is running locat = __dirname + "/ assets /"; (extension [ext]) {localPath + = (dir? Dir + "/": "") + filename; fs.exists (local path (If available) {getFile (local text, extension [ext], res);} {Res.writeHead (404); res.end ();}}}}} getFile (localpath, Mimetype, ridge) {fs.readFile (localpath, function (error, content) {if (! Err {Res.writeHead (200, {"content-type": mimeType, "content-length": contents.length}); Res.end (content);} and {res.writeHead (500); Res.end (); }}); }}) Listen (process.env.port || 3000, function () {console.log ("listening on 3000");});  

Procfile

  Web: nodejs web.js  

Package .json

  {"name": "myapp", "version": "0.0.1", "description": "web developer", "main": "web "", "Script": {"test": "echo \" error: no test specified \ "& amp; Amp; Amp; Amp; Amp; Amp; Engine ": {" node ":" 0.8.x "," npm ":" 1.1.x "}," repository ": {" type ":" git "," url ":" https://github.com / "" "", "Keyword": ["node", "horoku"] ​​ 

< P> By default this is:

  node web.js  

Unless you specify under the package. Otherwise.

Edit file

  Web: node web.js  

should do this. :)


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -