Created
August 13, 2017 12:39
-
-
Save beardlessman/089aab9ea7f6a7eb31794fcc0a614fed to your computer and use it in GitHub Desktop.
express server on localhost:3000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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