diff --git a/README.md b/README.md index e41fe83377cfdd69e44b64ec66842caa82bc0eec..0c36372077dc52f20e792ebe2e323236d109dbc5 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 85f29086123b1de9e7cfd09c8a07ddb08dacc788..146cc6816e77321c39787830ce3e18f574611ba0 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 0ec847047d48a1e1c27256fbdc0f7e9abcecec47..4fadd9f3fe9245850238736a81b8889858acbcae 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