cleaned up some files

This commit is contained in:
RustyRaptor authored and RustyRaptor committed 2018-02-04 06:27:44 -07:00
1 parent bbcc34b5d9
commit 292afbe3ec
5 files changed
+125 -156

No files matched your search

+1 -2
View File
@@ -1,4 +1,3 @@
# 5Anime
[![Join the chat at https://gitter.im/5Anime/Lobby](https://badges.gitter.im/5Anime/Lobby.svg)](https://gitter.im/5Anime/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Anime list
NodeJS and MongoDB webapp for keeping track of what anime you've seen and what anime you should watch next. Uses machine learning to help find more anime you like and connect you with other users who like the same kind of anime.
+1 -4
View File
@@ -1,8 +1,5 @@
var mongoose = require('mongoose')
mongoose.connect('mongodb://localhost:27017/test', { useMongoClient: true })
mongoose.Promise = global.Promise
mongoose.connect('mongodb://localhost:27017/tests', {
useMongoClient: true,
})
module.exports = { mongoose }
+80 -90
View File
@@ -1,18 +1,8 @@
const fetch = require('isomorphic-fetch')
const {
MongoClient,
ObjectID
} = require('mongodb')
const mongoose = require('./db/mongoose')
const {Anime} = require('./models/anime')
// const mongoose = require('./db/mongoose')
// const bodyParser = require('body-parser')
// const {Anime} = require('./models/anime')
var obj = new ObjectID()
console.log(obj)
var query = `
query ($id: Int) {
Media (id: $id, type: ANIME) {
@@ -53,82 +43,82 @@ var url = 'https://graphql.anilist.co',
variables: variables
})
}
const mongoose = require('mongoose')
mongoose.connect('mongodb://localhost:27017/test', { useMongoClient: true })
mongoose.Promise = global.Promise
// const mongoose = require('mongoose')
// mongoose.connect('mongodb://localhost:27017/test', { useMongoClient: true })
// mongoose.Promise = global.Promise
var Anime = mongoose.model('Anime', {
id: {
type: Number,
required: true,
},
idMal: {
type: Number,
},
title: {
romaji: {
type: String,
required: true,
minlength: 1,
trim: true,
},
english: {
type: String,
},
native: {
type: String,
},
},
// title: {
// type: String,
// required: true,
// minlength: 1,
// trim: true,
// },
// titleEnglish: {
// type: String,
// },
// titleRomaji: {
// type: String,
// },
// titleNative: {
// type: String,
// },
genres: {
type: Array,
},
episodes: {
type: Number,
required: true,
},
description: {
type: String,
required: true,
minlength: 1,
},
type: {
type: String,
},
format: {
type: String,
},
status: {
type: String,
required: true,
},
season: {
type: String,
},
duration: {
type: Number,
},
chapters: {
type: Number,
},
volumes: {
type: Number,
}
})
// var Anime = mongoose.model('Anime', {
// id: {
// type: Number,
// required: true,
// },
// idMal: {
// type: Number,
// },
// title: {
// romaji: {
// type: String,
// required: true,
// minlength: 1,
// trim: true,
// },
// english: {
// type: String,
// },
// native: {
// type: String,
// },
// },
// // title: {
// // type: String,
// // required: true,
// // minlength: 1,
// // trim: true,
// // },
// // titleEnglish: {
// // type: String,
// // },
// // titleRomaji: {
// // type: String,
// // },
// // titleNative: {
// // type: String,
// // },
// genres: {
// type: Array,
// },
// episodes: {
// type: Number,
// required: true,
// },
// description: {
// type: String,
// required: true,
// minlength: 1,
// },
// type: {
// type: String,
// },
// format: {
// type: String,
// },
// status: {
// type: String,
// required: true,
// },
// season: {
// type: String,
// },
// duration: {
// type: Number,
// },
// chapters: {
// type: Number,
// },
// volumes: {
// type: Number,
// }
// })
fetch(url, options).then(handleResponse)
@@ -136,7 +126,7 @@ fetch(url, options).then(handleResponse)
.catch(handleError)
function handleResponse(response) {
return response.json().then(function(json) {
return response.json().then((json) => {
return response.ok ? json : Promise.reject(json)
})
}
@@ -156,11 +146,11 @@ function handleData(data) {
description: data.data.Media.description,
status: data.data.Media.status,
})
anime.save(function (e) {
anime.save((e) => {
if (e) {
console.log(e)
} else {
console.log('Aw shit it worked')
console.log('Yee boi it worked')
}
})
}
+27 -4
View File
@@ -9,11 +9,34 @@ var Anime = mongoose.model('Anime', {
type: Number,
},
title: {
type: Object,
required: true,
minlength: 1,
trim: true,
romaji: {
type: String,
required: true,
minlength: 1,
trim: true,
},
english: {
type: String,
},
native: {
type: String,
},
},
// title: {
// type: String,
// required: true,
// minlength: 1,
// trim: true,
// },
// titleEnglish: {
// type: String,
// },
// titleRomaji: {
// type: String,
// },
// titleNative: {
// type: String,
// },
genres: {
type: Array,
},
+16 -56
View File
@@ -1,45 +1,7 @@
const express = require('express')
const hbs = require('hbs')
const parseString = require('xml2js').parseString
const fs = require('fs')
const {MongoClient, ObjectID} = require('mongodb')
const assert = require('assert')
const port = process.env.PORT || 3000
var obj = new ObjectID()
console.log(obj)
fs.readFile(__dirname + '/anime-titles.xml', function(err, data) {
parseString(data, function (err, result) {
// console.dir(JSON.stringify(result));
console.log('Done')
var meme = result
MongoClient.connect('mongodb://localhost:27017/5Anime', (err, db) => {
if (err) {
return console.log('unable to connect to mongodb server')
}
console.log('connected to mongodb server')
db.collection('test').insertMany(
[
]
).then((result) => {
console.log(result)
})
})
})
})
var app = express()
@@ -70,25 +32,23 @@ app.get('/', (req, res) => {
})
})
// app.get("/accelworld", (req, res) => {
// res.render("details.hbs", {
// animetitle: "Accel World",
// animecoverjpg: "../../../images/accelworldcover.jpg",
// animedesc: "The year is 2046. Haruyuki Arita is a young boy who finds himse" +
// "lf on the lowest social rungs of his school. Ashamed of his miserable life," +
// "Haruyuki can only cope by indulging in virtual games. But that all changes" +
// "when Kuroyukihime, the most popular girl in school, introduces him to a m" +
// "ysterious program called Brain Burst and a virtual reality called the Acc" +
// "el World.",
// episodecount: "24",
// genres: "Action, Game, Romance, School, Sci-Fi, Shounen",
// releasedate: "2012",
// styleSheet: "/variables.css"
// });
// });
app.get('/accelworld', (req, res) => {
res.render('details.hbs', {
animetitle: 'Accel World',
animecoverjpg: '../../../images/accelworldcover.jpg',
animedesc: 'The year is 2046. Haruyuki Arita is a young boy who finds himse' +
'lf on the lowest social rungs of his school. Ashamed of his miserable life,' +
'Haruyuki can only cope by indulging in virtual games. But that all changes' +
'when Kuroyukihime, the most popular girl in school, introduces him to a m' +
'ysterious program called Brain Burst and a virtual reality called the Acc' +
'el World.',
episodecount: '24',
genres: 'Action, Game, Romance, School, Sci-Fi, Shounen',
releasedate: '2012',
styleSheet: '/variables.css'
})
})
// /bad - send back json with errorMessage
app.get('/bad', (req, res) => {
res.send({
errorMessage: 'Unable to handle request'