Created
March 3, 2016 18:10
-
-
Save leandroh/ba5d33e017b6544877c4 to your computer and use it in GitHub Desktop.
Node.js minimal web server
This file contains 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 bodyParser = require('body-parser'); | |
var app = express(); | |
app.use(bodyParser.json()); | |
app.get('/maps', function(req, res) { | |
var dados = [ | |
{ | |
lat: -25.470991, | |
lon: -49.271036 | |
}, | |
{ | |
lat: -0.935586, | |
lon: -49.635540 | |
}, | |
{ | |
lat: -2.485874, | |
lon: -43.128493 | |
} | |
]; | |
res.send(JSON.stringify(dados)); | |
}); | |
app.listen(8000, function() { | |
console.log('Servidor rodando na porta 8000.'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment