Skip to content

Instantly share code, notes, and snippets.

@beardlessman
Created August 13, 2017 12:39
Show Gist options
  • Save beardlessman/089aab9ea7f6a7eb31794fcc0a614fed to your computer and use it in GitHub Desktop.
Save beardlessman/089aab9ea7f6a7eb31794fcc0a614fed to your computer and use it in GitHub Desktop.
express server on localhost:3000
var express = require('express');
var app = express();
app.set('port', (process.env.PORT || 3000));
app.use('/', express.static(__dirname));
app.listen(app.get('port'), function() {
console.log('Server started: http://localhost:' + app.get('port') + '/');
});
// прописать в package.json
// ...
// "scripts": {
// "start": "node server.js"
// }
// ...
// установить сервер
// npm install express --save-dev
// запуск
// npm start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment