From 9a25381d7dc0a6326e19be8bbcbc73395328c157 Mon Sep 17 00:00:00 2001 From: Vytor Calixto <vytorcalixto@gmail.com> Date: Fri, 24 Jun 2016 09:44:49 -0300 Subject: [PATCH] Basic prototype Not following any specs --- README.md | 7 +------ libs/app.js | 2 +- libs/routes/api.js | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e41fe833..0c363720 100644 --- a/README.md +++ b/README.md @@ -1,6 +1 @@ -# Node+Express base - -This project contains necessary files and code to start a NodeJS+Express server. - -## License -This project is under the [MIT License](LICENSE). +# SIMCAQ diff --git a/libs/app.js b/libs/app.js index 85f29086..146cc681 100644 --- a/libs/app.js +++ b/libs/app.js @@ -18,7 +18,7 @@ app.use(bodyParser.urlencoded({ extended: false })) app.use(cookieParser()) app.use(methodOverride()) -app.use('/v1/', api) +app.use('/api/v1/', api) // catch 404 and forward to error handler app.use(function(req, res, next){ diff --git a/libs/routes/api.js b/libs/routes/api.js index 0ec84704..4fadd9f3 100644 --- a/libs/routes/api.js +++ b/libs/routes/api.js @@ -14,4 +14,27 @@ router.get('/', function (req, res) { }) }) +router.get('/data', function(req, res) { + console.log(req.query) + console.log(req.query.met) + console.log(req.query.dim) + conn.query( + 'SELECT * FROM turmas' + ).then(function(result) { + res.json({ + result: result + }) + }) +}) + +router.get('/matriculas', function(req, res) { + conn.query( + 'SELECT count(VT07) FROM turmas WHERE VT11 <= 3' + ).then(function(result) { + res.json({ + result: result + }) + }) +}) + module.exports = router -- GitLab