Archived
.
This commit is contained in:
1 parent
6abb6530bd
commit
683b228666
4 files changed
+2264
-30
No files matched your search
+15
-16
@@ -1,7 +1,6 @@
|
|||||||
|
const express = require("express");
|
||||||
const express = require('express')
|
const app = express();
|
||||||
const app = express()
|
const port = process.env.PORT || 3000;
|
||||||
const port = process.env.PORT || 3000
|
|
||||||
const { MONGO_URI } = require("./config");
|
const { MONGO_URI } = require("./config");
|
||||||
const mongoose = require("mongoose");
|
const mongoose = require("mongoose");
|
||||||
const events = require("./models/events");
|
const events = require("./models/events");
|
||||||
@@ -12,17 +11,17 @@ mongoose
|
|||||||
})
|
})
|
||||||
.then(() => console.log("connected"))
|
.then(() => console.log("connected"))
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => console.log(err));
|
||||||
app.get('/', async (req, res) => {
|
app.get("/api", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const event = await events.find({ mess : "one" });
|
const event = await events.find({ mess: "one" });
|
||||||
if (!event) throw Error("something went wrong");
|
if (!event) throw Error("something went wrong");
|
||||||
console.log(event)
|
console.log(event);
|
||||||
res.status(200).json(event);
|
res.status(200).json(event);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
res.status(400).json({ msg: err });
|
res.status(400).json({ msg: err });
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Example app listening at http://localhost:${port}`)
|
console.log(`Example app listening at http://localhost:${port}`);
|
||||||
})
|
});
|
||||||
@@ -2,10 +2,26 @@ const mongoose = require("mongoose");
|
|||||||
const schema = mongoose.Schema;
|
const schema = mongoose.Schema;
|
||||||
|
|
||||||
const eventSchema = new schema({
|
const eventSchema = new schema({
|
||||||
mess: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
}
|
},
|
||||||
|
date: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
time: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
lat: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
lon: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = mongoose.model("events", eventSchema);
|
module.exports = mongoose.model("events", eventSchema);
|
||||||
Generated
+2227
-10
File diff suppressed because it is too large.
Load diff
+4
-2
@@ -8,10 +8,12 @@ import {
|
|||||||
import Stack from 'react-bootstrap/Stack'
|
import Stack from 'react-bootstrap/Stack'
|
||||||
import Container from 'react-bootstrap/Container'
|
import Container from 'react-bootstrap/Container'
|
||||||
import Logo from "./components/Logo/index.js";
|
import Logo from "./components/Logo/index.js";
|
||||||
|
import Hand from "./components/AnimatedHand/Hand.js";
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<div>
|
<div>
|
||||||
|
<Logo/>
|
||||||
{/* A <Switch> looks through its children <Route>s and
|
{/* A <Switch> looks through its children <Route>s and
|
||||||
renders the first one that matches the current URL. */}
|
renders the first one that matches the current URL. */}
|
||||||
<Switch>
|
<Switch>
|
||||||
@@ -32,7 +34,7 @@ import {
|
|||||||
|
|
||||||
function Home() {
|
function Home() {
|
||||||
return (
|
return (
|
||||||
<div className={styles.con}> <Stack gap={1}>
|
<div className={styles.con}><Stack gap={1}>
|
||||||
<div className={styles.item}>First item</div>
|
<div className={styles.item}>First item</div>
|
||||||
<div className={styles.item}>Second item</div>
|
<div className={styles.item}>Second item</div>
|
||||||
<div className={styles.item}>Third item</div>
|
<div className={styles.item}>Third item</div>
|
||||||
@@ -41,7 +43,7 @@ import {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function About() {
|
function About() {
|
||||||
return <Logo/>;
|
return <Hand/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Users() {
|
function Users() {
|
||||||
|
|||||||
Reference in new issue
Block a user