<commit_before>'use strict';

/**
 * Module dependencies.
 */
var users = require('../../app/controllers/users.server.controller'),
	articles = require('../../app/controllers/articles.server.controller');

module.exports = function(app) {
	// Article Routes
	app.route('/articles')
		.get(articles.list)
		.post(users.requiresLogin, articles.create);

	app.route('/articles/:articleId')
		.get(articles.read)
		.put(users.requiresLogin, articles.hasAuthorization, articles.update)
		.delete(users.requiresLogin, articles.hasAuthorization, articles.delete);

	// Finish by binding the article middleware
	app.param('articleId', articles.articleByID);
};<commit_msg>basic routing sketch<commit_after>'use strict';

/**
 * Module dependencies.
 */
var users = require('../../app/controllers/users.server.controller'),
	articles = require('../../app/controllers/articles.server.controller');

module.exports = function(app) {
		// Article Routes
		app.route('/articles')



		.get(function(req, res, next) {
					mongoose.model('User').find({}, function(err, users) {
						if (err) {
							return console.error(err);
						} else {
							// send back all the profiles
						}
					})
				}



				.post(function(formData) { // this should be the form data. how to link user and profile without foreign keys?
						mongoose.model('User').create(formData);
					}, function(err, user) {
						if (err) {
							res.send("Problem");
						} else {
							console.log("user created: ", formData.basic.username)
							res.format({
								res.location("profile");
								res.redirect("/profile");
							})
						}
					};



					app.route('/articles/:articleId')
					.get(articles.read)
					.put(users.requiresLogin, articles.hasAuthorization, articles.update)
					.delete(users.requiresLogin, articles.hasAuthorization, articles.delete);

					// Finish by binding the article middleware
					app.param('articleId', articles.articleByID);
				};

{'fraction_non_alphanumeric': 0.1591375770020534, 'fraction_numerical': 0.0, 'mean_word_length': 3.146808510638298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7540284', 'n_tokens_mistral': 728, 'n_tokens_neox': 566, 'n_words': 110}