Skip to content
Snippets Groups Projects
Commit 21f1bc9f authored by Fin Wallis's avatar Fin Wallis
Browse files

added index.js to backend/models in order to allow getting data on users and events

parent 1feef938
No related branches found
No related tags found
1 merge request!14Buy tickets, view owned tickets and miscellaneous files added
[
{
"id": 1,
"eventTitle": "Stormzy - London Arena",
"organiser": "O2",
"venueName": "O2 Arena",
"venueAddress": "Peninsula Square, London SE10 0DX",
"eventGenre": "Grime",
"startDate": "13 February 2022",
"endDate": "13 February 2022",
"startTime": "20:00",
"endTime": "23:00",
"ticketPrice": "50.00",
"ticketQty": "150",
"eventImage": "https://www.stormzy.com/files/2021/05/OGIMAGE-compressed.jpg",
"eventDescription": "Off the back of his acclaimed 2019 album Heavy Is The Head, Stormzy had previously announced a 2021 UK tour. He has now confirmed that the supporting tour has been moved to March and April 2022."
},
{
"id": 2,
"eventTitle": "Dave - London Arena",
"organiser": "O2",
"venueName": "O2 Arena",
"venueAddress": "Peninsula Square, London SE10 0DX",
"eventGenre": "Grime",
"startDate": "16 February 2022",
"endDate": "16 February 2022",
"startTime": "20:00",
"endTime": "23:00",
"ticketPrice": "50.00",
"ticketQty": "150",
"eventImage": "https://static.independent.co.uk/s3fs-public/thumbnails/image/2019/03/07/17/dave.jpg?width=982&height=726&auto=webp&quality=75",
"eventDescription": "Brixton-born rapper and musical prodigy Dave, whose real name is David Orobosa Omoregie, began composing from an early age and writing lyrics in his teens. Growing up in Streatham, South London wasn’t easy so focusing on music helped him cope."
},
{
"id": 3,
"eventTitle": "Drake - Wembley Arena",
"organiser": "Wembley Organisers LTD",
"venueName": "Wembley Arena",
"venueAddress": "Arena Square, Engineers Way, London HA9 0AA",
"eventGenre": "Pop",
"startDate": "28 February 2022",
"endDate": "28 February 2022",
"startTime": "20:00",
"endTime": "23:00",
"ticketPrice": "89.00",
"ticketQty": "150",
"eventImage": "https://www.biography.com/.image/ar_1:1%2Cc_fill%2Ccs_srgb%2Cfl_progressive%2Cq_auto:good%2Cw_1200/MTQ3NTI2OTA4NzY5MjE2MTI4/drake_photo_by_prince_williams_wireimage_getty_479503454.jpg",
"eventDescription": "Platinum selling, chart dominating powerhouse Drake announces the ‘ASSASSINATION VACATION TOUR’ with support from fellow Canadian rapper, singer, songwriter Tory Lanez. Fresh off the back of his sell out U.S tour, Drake will be taking his stellar production onto the U.K and Europe."
}
]
\ No newline at end of file
module.exports = {
url: "mongodb://localhost:27017/TickcryptDB"
};
\ No newline at end of file
...@@ -10,14 +10,20 @@ const app = express(); ...@@ -10,14 +10,20 @@ const app = express();
const PORT = 4000; const PORT = 4000;
var bodyParser = require('body-parser') var bodyParser = require('body-parser')
const db = require("./models")
// MongoDB connection // MongoDB connection
mongoose.Promise = global.Promise; db.mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost/TickcryptDB', { db.mongoose.connect('mongodb://localhost/TickcryptDB', {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true useUnifiedTopology: true
}) })
.then((result) => console.log('Connected to DB')) .then((result) => console.log('Connected to DB'))
.catch((err) => console.log(err)); .catch((err) => {
// Close process after
console.log(err)
process.exit();
});
// Body parser setup // Body parser setup
app.use(express.urlencoded({extended: true})); app.use(express.urlencoded({extended: true}));
......
...@@ -61,3 +61,6 @@ export const EventSchema = new Schema({ ...@@ -61,3 +61,6 @@ export const EventSchema = new Schema({
} }
}) })
const Event = mongoose.model('Event', EventSchema);
module.exports = Event
const dbConfig = require("../config/db.config.js");
const mongoose = require("mongoose");
mongoose.Promise = global.Promise;
const db = {};
db.mongoose = mongoose;
db.url = dbConfig.url;
db.events = require("./eventModel.js")(mongoose);
db.users = require("./userModel.js")(mongoose);
module.exports = db;
\ No newline at end of file
import React from 'react'; import React, { useEffect, useState } from 'react';
const Marketplace = () => { const Marketplace = () => {
const [allTickets, setAllTickets] = useState([]);
useEffect(() =>{
},[]);
return ( return (
<div> <div>
This is marketplace This is marketplace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment