Download code/train/JavaScript/0013431_getWeight.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 528 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/train/JavaScript/0013431_getWeight.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/code/train/JavaScript/0013431_getWeight.js
-
curl -L -o 0013431_getWeight.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/train/JavaScript/0013431_getWeight.js
528 Bytes
| ; | |
| const mongoose = require('mongoose'); | |
| const Weight = require('../models/weight'); | |
| module.exports = function (req, res) { | |
| Weight.find({ | |
| user: req.user.sub.toString() | |
| }, {'_id':0, 'date':1, 'user':1, 'weight':1, 'feel':1}, | |
| function (err, weights) { | |
| if (err) { | |
| res.send(err); | |
| } else { | |
| var nWeights = weights.sort(function(a,b){ | |
| return new Date(a.date) - new Date(b.date); | |
| }); | |
| res.json(nWeights); | |
| } | |
| }) | |
| } | |