Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glim. Final project by Izabel, Linda and Martin #56

Open
wants to merge 334 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
334 commits
Select commit Hold shift + click to select a range
d38ac83
fixed drag
Martin-Joensson Jun 4, 2024
af28f06
fixed signup button in hero
Martin-Joensson Jun 4, 2024
917eebc
adding first six pictures from cloudinary
linda-f Jun 4, 2024
fe7ceab
First pass on statement section
Martin-Joensson Jun 4, 2024
3eaba00
changed text-alignment
Martin-Joensson Jun 4, 2024
076def0
Mission and footer
Martin-Joensson Jun 4, 2024
00ed238
doing middle stage of signup
linda-f Jun 4, 2024
58f0ec2
added maps for statements and icons, still needs work
Martin-Joensson Jun 4, 2024
8d94dad
adding new pictures and updating product schema
linda-f Jun 4, 2024
c833d60
updating user schema
linda-f Jun 4, 2024
3cf3433
Merge pull request #15 from Izzibizz/productdata
linda-f Jun 4, 2024
c0afbad
fixing backend stuff because of render crash
linda-f Jun 4, 2024
9e0c5c0
fixing one more validation issue
linda-f Jun 4, 2024
fce9331
fixing allergy issue
linda-f Jun 4, 2024
315ccb3
adding first sign up part
linda-f Jun 5, 2024
b4821f4
adding new products
linda-f Jun 5, 2024
d338a6d
fixing array things
linda-f Jun 5, 2024
e7de979
adding new pictures to the data
linda-f Jun 5, 2024
0f432ea
fix picture sizes
linda-f Jun 5, 2024
924c4c7
removing consolelog
linda-f Jun 5, 2024
ad4b641
working on signup
linda-f Jun 5, 2024
cb12146
working on select
linda-f Jun 5, 2024
765939a
finishing mobile view
linda-f Jun 5, 2024
622dcf3
making the pages in the signup show after one another
linda-f Jun 5, 2024
6ce34b8
woking on tablet view
linda-f Jun 5, 2024
c6edaeb
working on product-list page
Izzibizz Jun 5, 2024
612c4ed
Footer contact done, needs links in data.json
Martin-Joensson Jun 6, 2024
b51f0b7
workin on tablet
linda-f Jun 6, 2024
9cc6949
Statements and footer done
Martin-Joensson Jun 6, 2024
df17aaa
Renamed component for clarity
Martin-Joensson Jun 6, 2024
5c30ebe
started single product page
Izzibizz Jun 6, 2024
7ddcb32
Merge pull request #16 from Izzibizz/statement
Martin-Joensson Jun 6, 2024
f4bffe7
Merge pull request #17 from Izzibizz/footer
Martin-Joensson Jun 6, 2024
515ef92
Merge pull request #18 from Izzibizz/productlist
Martin-Joensson Jun 6, 2024
cd0b28a
Merge pull request #19 from Izzibizz/singleproduct
Martin-Joensson Jun 6, 2024
53eb032
changed how we manage the data and added an error message
Izzibizz Jun 6, 2024
cb5e5d9
messed with product card spacing
Martin-Joensson Jun 6, 2024
7feff89
started some responsiveness
Izzibizz Jun 6, 2024
1159ec7
added some styling to text
Izzibizz Jun 6, 2024
1e5577c
Added not found component
Martin-Joensson Jun 6, 2024
9431359
The footer can now be customized to which page it is on.
Martin-Joensson Jun 6, 2024
dd0f642
added footer to all pages
Martin-Joensson Jun 6, 2024
d3feada
updated Nav to be sticky.
Martin-Joensson Jun 6, 2024
0c31745
Review form done, needs to be connected to backend
Martin-Joensson Jun 6, 2024
8f8d53d
redesigning the preview products.
Martin-Joensson Jun 6, 2024
9ac33cd
doing pages 1&2 of tablet
linda-f Jun 7, 2024
8dfdd5e
finishing the tablet thing
linda-f Jun 7, 2024
a56520c
updated function to filter
Izzibizz Jun 7, 2024
c4a7460
starting on laptop view
linda-f Jun 7, 2024
c504ea5
added Login modal
Martin-Joensson Jun 7, 2024
2193695
added filtering sorting
Izzibizz Jun 7, 2024
f064829
added similar products component
Izzibizz Jun 7, 2024
5115eda
working on laptop
linda-f Jun 7, 2024
51822e3
Links to GitHub, Portfolio and LinkedIn
Martin-Joensson Jun 7, 2024
0752261
finishing up the laptop thing
linda-f Jun 8, 2024
66b0126
fixed allergy function, back button etc
Izzibizz Jun 9, 2024
578b35a
Merge branch 'main' into signup
linda-f Jun 9, 2024
de16355
Merge pull request #20 from Izzibizz/signup
linda-f Jun 9, 2024
d787e60
fixing typo
linda-f Jun 9, 2024
b004ca0
added Images
Martin-Joensson Jun 9, 2024
5beb9ba
tweaked links
Martin-Joensson Jun 9, 2024
f2c8d43
Merge branch 'main' into aboutus
Martin-Joensson Jun 9, 2024
8864d82
going back a commit
linda-f Jun 9, 2024
d51fd17
Merge branch 'main' into aboutus
Martin-Joensson Jun 9, 2024
faf5c3d
Merge pull request #21 from Izzibizz/aboutus
Martin-Joensson Jun 9, 2024
9b0070b
deleted double import
Martin-Joensson Jun 9, 2024
21fe81f
Merge branch 'main' into singleproduct
Martin-Joensson Jun 10, 2024
8f5d385
Merge pull request #22 from Izzibizz/singleproduct
Martin-Joensson Jun 10, 2024
709d7a0
fixed filter and sort
Martin-Joensson Jun 10, 2024
51ba31b
Fixed singleproduct page
Martin-Joensson Jun 10, 2024
55b4724
sign up functionality, not finished
Martin-Joensson Jun 10, 2024
cee7306
added reason to NotFound in routes
Martin-Joensson Jun 10, 2024
fa237ca
first section of sign up
Martin-Joensson Jun 10, 2024
0a0ebdf
Section two
Martin-Joensson Jun 10, 2024
4101c67
Section Three, checkboxes
Martin-Joensson Jun 10, 2024
a83034e
Selects working
Martin-Joensson Jun 10, 2024
469907c
imported Zustand props
Martin-Joensson Jun 10, 2024
c00b47a
started cart and worked in the store
Izzibizz Jun 10, 2024
8c80790
need to make increment and decrement work in cart
Izzibizz Jun 10, 2024
2b03b80
fixing the price rounding
Izzibizz Jun 10, 2024
fbaeabf
Able to add values to the allergie and pros arrays. They are one behi…
Martin-Joensson Jun 10, 2024
18f3a25
Added handleSubmit for testing, as well as a resetFields function
Martin-Joensson Jun 10, 2024
b68ff8b
Prepared for the registerUser
Martin-Joensson Jun 10, 2024
ce0465e
started login functionality
Martin-Joensson Jun 10, 2024
2289de8
worked on popup checkout cart
Izzibizz Jun 10, 2024
c554ff2
added logout in store
Martin-Joensson Jun 11, 2024
89919fd
Registration complete
Martin-Joensson Jun 11, 2024
1ddc26d
added in resetFields when you submit and a disabled option for the dr…
Martin-Joensson Jun 11, 2024
6bc0a53
added all information to login data.
Martin-Joensson Jun 11, 2024
166b8f0
removed unneeded info
Martin-Joensson Jun 11, 2024
16526fc
Merge pull request #23 from Izzibizz/signupfunc
Martin-Joensson Jun 11, 2024
f71217b
fixed last style of cart, also the popupcart and started userpage in …
Izzibizz Jun 11, 2024
9e4f1d5
Merge pull request #24 from Izzibizz/shoppingcart
Martin-Joensson Jun 11, 2024
fa6d2d3
Able to fetch userinfo
Martin-Joensson Jun 11, 2024
c10c0e9
work on productpage
Martin-Joensson Jun 11, 2024
9f7c971
Removed login page, added recommended to products page.
Martin-Joensson Jun 11, 2024
1b000d2
added Logout button, no function
Martin-Joensson Jun 11, 2024
4d9da76
fixed log out and started welcome message
Izzibizz Jun 11, 2024
07dd409
fixed some bugs with login popup and styled
Izzibizz Jun 11, 2024
e240be3
fixed timeout
Izzibizz Jun 11, 2024
ac82783
added animation in login loading
Izzibizz Jun 11, 2024
ac234dd
adding update user patch in the store
linda-f Jun 12, 2024
73f7ca5
woking on profile page for patch request
linda-f Jun 12, 2024
f589920
added automatic log out 15 minutes in
Izzibizz Jun 12, 2024
d2abde8
added swoops to similar products component
Martin-Joensson Jun 12, 2024
39057ef
Changed yellow color to match swoop in homepage
Martin-Joensson Jun 12, 2024
5416084
working on isediting
linda-f Jun 12, 2024
5754d77
Added swoops to Sign up form
Martin-Joensson Jun 12, 2024
a93f806
Changed the About Us text
Martin-Joensson Jun 12, 2024
9f45e2d
working on it
linda-f Jun 12, 2024
4d5add1
stuff
linda-f Jun 12, 2024
39f31f4
fixed logged in hero image with different cta
Izzibizz Jun 12, 2024
c814ecb
Merge pull request #25 from Izzibizz/patch
Martin-Joensson Jun 12, 2024
df23d18
Merge pull request #26 from Izzibizz/login-logout
Martin-Joensson Jun 12, 2024
2f86adf
Merge pull request #27 from Izzibizz/todo
Martin-Joensson Jun 12, 2024
7aa2e4d
signup
Martin-Joensson Jun 12, 2024
a35a02b
Merge pull request #28 from Izzibizz/todo
Martin-Joensson Jun 12, 2024
1a41a95
Burger closes on click outside. As well as when clicking a link
Martin-Joensson Jun 12, 2024
a6568e7
changed closing X in burger
Martin-Joensson Jun 12, 2024
9597546
removed unused files
Martin-Joensson Jun 12, 2024
97a540e
input fields work
linda-f Jun 12, 2024
82d8952
working on updating the user
linda-f Jun 12, 2024
9df6668
enlarged icons in navigation
Martin-Joensson Jun 12, 2024
5ed5511
added swoop-profile files, not implemented yet.
Martin-Joensson Jun 12, 2024
b65cd88
added popup for signup success
Izzibizz Jun 12, 2024
8636d6b
Merge branch 'main' into login-logout
Izzibizz Jun 12, 2024
7fbfb2d
Merge pull request #30 from Izzibizz/login-logout
Izzibizz Jun 12, 2024
f0e99b7
Merge pull request #29 from Izzibizz/navigation-fix
Izzibizz Jun 12, 2024
0f11342
started logout message
Izzibizz Jun 12, 2024
acfef64
Merge pull request #31 from Izzibizz/profile
linda-f Jun 12, 2024
9e952f7
backend complete according to antonella not tested
linda-f Jun 12, 2024
d667850
doing frontend according to anntonella
linda-f Jun 12, 2024
5e198df
Merge pull request #32 from Izzibizz/stripe
linda-f Jun 12, 2024
65ab2d0
fixed issue that popup was showing whenever browser refreshed
Izzibizz Jun 12, 2024
6a6374f
doing dotenv file
linda-f Jun 12, 2024
52c5b99
commenting out dotenv again
linda-f Jun 12, 2024
21c235b
Merge pull request #33 from Izzibizz/logout
Izzibizz Jun 13, 2024
6cbcaf8
wokring on stripe integration
linda-f Jun 13, 2024
fe38254
Got stuck on your postal Code is incomplete error message.
Martin-Joensson Jun 13, 2024
30d4559
fixing the filtering
Izzibizz Jun 13, 2024
42d200c
fixing stripe
linda-f Jun 13, 2024
abdcc19
Merge pull request #34 from Izzibizz/fixing
Martin-Joensson Jun 13, 2024
37c0ea0
Merge branch 'main' into stripetwo
Martin-Joensson Jun 13, 2024
9e9aca0
Merge pull request #35 from Izzibizz/stripetwo
Martin-Joensson Jun 13, 2024
19d8512
changed the data in json to be more correct and coherent
Izzibizz Jun 13, 2024
740c623
Merge pull request #36 from Izzibizz/logout
Izzibizz Jun 13, 2024
3ba6b05
fixed Cardnumber input not showing, fixed allergy thing.
Martin-Joensson Jun 13, 2024
b31ad0d
added organic in a nail polish
Izzibizz Jun 13, 2024
4eddd4a
Merge branch 'main' of https://github.com/Izzibizz/project-final
Izzibizz Jun 13, 2024
489fcf6
deleted console.log
Izzibizz Jun 13, 2024
a0f5c8c
Merge pull request #37 from Izzibizz/filter
Izzibizz Jun 13, 2024
4e41f6c
added _redirect
Martin-Joensson Jun 13, 2024
4f89e5d
fixed typo
Martin-Joensson Jun 13, 2024
77729ad
working on access
linda-f Jun 13, 2024
e8a149c
fixed filtering
Izzibizz Jun 13, 2024
557a40e
Merge pull request #38 from Izzibizz/filter
Izzibizz Jun 13, 2024
c9c7c65
Implemented Username in checkout.
Martin-Joensson Jun 13, 2024
3c4a9a7
Shopping cart done
Martin-Joensson Jun 13, 2024
6fef652
Tweaked the signup style
Martin-Joensson Jun 13, 2024
1ca2eb5
Updated Swoops
Martin-Joensson Jun 13, 2024
5b02c4b
Merge pull request #39 from Izzibizz/stripestyle
Martin-Joensson Jun 13, 2024
4a34432
added Featured to products
Martin-Joensson Jun 13, 2024
ed65205
fixed some styling and automatic popup, changed the code for the patc…
Izzibizz Jun 14, 2024
983c333
Merge branch 'main' into filter
Izzibizz Jun 14, 2024
52c3bcd
Merge pull request #40 from Izzibizz/filter
Izzibizz Jun 14, 2024
ad18896
last push before merge of branch
linda-f Jun 15, 2024
c9c03cd
Merge branch 'main' into access
linda-f Jun 15, 2024
162e2c1
Merge pull request #41 from Izzibizz/access
linda-f Jun 15, 2024
8ff8410
adding cors thing to backend
linda-f Jun 15, 2024
161f597
cleaning up emptry components
linda-f Jun 15, 2024
0a21abe
working on deleting user not functioning yet
linda-f Jun 15, 2024
d34ed79
fixed typo
Martin-Joensson Jun 15, 2024
a82fe7f
Cleaned up unused code.
Martin-Joensson Jun 15, 2024
e471da9
working on delete endpoint
linda-f Jun 15, 2024
3d2835c
Delete user working, added userId param to profile page
Martin-Joensson Jun 15, 2024
1a78d5b
fixed manually going into a profile
Martin-Joensson Jun 15, 2024
aa5fdf5
fixed displaying multiple allergies
Martin-Joensson Jun 15, 2024
94ccab2
Similar products will not show if there are no similar products. Also…
Martin-Joensson Jun 15, 2024
cb8e57a
Merge pull request #42 from Izzibizz/delete
linda-f Jun 15, 2024
493242a
working on patching
linda-f Jun 15, 2024
7ffdfbb
getting the updating partly working
linda-f Jun 15, 2024
8153b03
added loginMessage state
Martin-Joensson Jun 16, 2024
d0308bc
Merge branch 'main' into bugfixes
Martin-Joensson Jun 16, 2024
0277e6e
taking comment away
linda-f Jun 16, 2024
9b821cb
Merge pull request #43 from Izzibizz/bugfixes
Martin-Joensson Jun 16, 2024
14f4819
fixed displaying singleProductPage when logged out.
Martin-Joensson Jun 16, 2024
476ecf1
updated bc of typo
Martin-Joensson Jun 16, 2024
d68f0c2
Merge branch 'main' into patchagain
linda-f Jun 16, 2024
cdc58b5
Merge pull request #44 from Izzibizz/patchagain
linda-f Jun 16, 2024
65664f5
Carousel complete. fixed hero text
Martin-Joensson Jun 16, 2024
232eb40
Merge branch 'main' into carousel
Martin-Joensson Jun 16, 2024
b8f81de
added options to Flickity
Martin-Joensson Jun 16, 2024
93735b1
Merge branch 'carousel' of https://github.com/Izzibizz/project-final …
Martin-Joensson Jun 16, 2024
7ec121b
Merge pull request #45 from Izzibizz/carousel
Martin-Joensson Jun 16, 2024
34b97e3
Changed featured product sizing
Martin-Joensson Jun 16, 2024
a579cc8
fixed SingleProduct page
Martin-Joensson Jun 16, 2024
19666f0
Removed debugging console.logs
Martin-Joensson Jun 16, 2024
da419a7
fixed checkout and now working on the number on the cart icon
Izzibizz Jun 16, 2024
0a8bad0
fixed checkout and number on cart and for orderHistory to display in …
Izzibizz Jun 17, 2024
1feb37d
getting from 87 to 92
linda-f Jun 17, 2024
056ad86
fixed the order history to display and dissapear
Izzibizz Jun 17, 2024
9d4e7d8
Merge branch 'main' into shop
Izzibizz Jun 17, 2024
b90572e
Merge pull request #46 from Izzibizz/shop
Izzibizz Jun 17, 2024
847791a
fixing icons for organic etc and logged out state
Izzibizz Jun 17, 2024
e1db6b9
added links to footer SoMe icons, only the GitHub icons links to this…
Martin-Joensson Jun 17, 2024
bf56e89
adding recommended for in logged out state single product
Izzibizz Jun 18, 2024
db51f45
fixed recommendation tags etc
Izzibizz Jun 18, 2024
c1961d1
Merge pull request #47 from Izzibizz/testpatch
Izzibizz Jun 18, 2024
a8a1712
trying out changing updatedUser to user
Izzibizz Jun 18, 2024
bc36fe1
Merge branch 'main' into acc
linda-f Jun 19, 2024
0a47581
Merge pull request #48 from Izzibizz/acc
linda-f Jun 19, 2024
9756485
Merge pull request #49 from Izzibizz/footer2
linda-f Jun 19, 2024
8529148
fixed login error message and some style
Izzibizz Jun 19, 2024
b01a665
styling on profile
Izzibizz Jun 20, 2024
790b2c8
updated some positions in the profile page
Izzibizz Jun 20, 2024
14a30fb
changed font sizes and widths in footer to display better on smaller …
Martin-Joensson Jun 20, 2024
d866246
Merge pull request #50 from Izzibizz/footerresponse
Martin-Joensson Jun 20, 2024
f0048c5
Added alt tags to all images
Martin-Joensson Jun 20, 2024
6bd3fe5
adding readme
linda-f Jun 20, 2024
4694b0e
Merge branch 'main' of https://github.com/Izzibizz/project-final
linda-f Jun 20, 2024
648dc3a
Changed the colors for main-red and main-green to improve accessibili…
Martin-Joensson Jun 20, 2024
5701e0e
working on cleaning up the code
linda-f Jun 20, 2024
be4df36
deleted svg
Izzibizz Jun 20, 2024
1c03ca9
changed edit buttong and delete button
Izzibizz Jun 20, 2024
7af621f
Merge branch 'main' into profile
Izzibizz Jun 20, 2024
5787530
Merge pull request #51 from Izzibizz/profile
Izzibizz Jun 20, 2024
0915c64
added aria-label to edit profile button. Restructured h tags to follo…
Martin-Joensson Jun 20, 2024
67551cb
Merge branch 'main' into accessibility
Martin-Joensson Jun 20, 2024
8707a4a
Merge pull request #52 from Izzibizz/accessibility
Martin-Joensson Jun 20, 2024
818c2d6
Removed review form from single product page.
Martin-Joensson Jun 20, 2024
ed725b0
Cleaned up the swoops
Martin-Joensson Jun 20, 2024
25622c1
Changed color of swoops deleted unused swoops.
Martin-Joensson Jun 20, 2024
878fa76
changed text sizes in nav to make them more cohesive
Martin-Joensson Jun 20, 2024
1b80aa4
cleaning up code and readme
linda-f Jun 21, 2024
46b705a
Merge branch 'main' into cleanup
linda-f Jun 21, 2024
05a6d10
Merge pull request #53 from Izzibizz/cleanup
linda-f Jun 21, 2024
f0227be
fixing delete message
linda-f Jun 21, 2024
6a6da6f
Merge pull request #54 from Izzibizz/deletemessage
linda-f Jun 21, 2024
5e7545d
working on moving pictures
linda-f Jun 21, 2024
15d34ac
hero images moved
Martin-Joensson Jun 21, 2024
30a2dbe
cleaned up all the images and icons. structured them in folders.
Martin-Joensson Jun 21, 2024
73cd22e
commented out review stars in singleproduct page
Martin-Joensson Jun 21, 2024
dad8c85
fixing icons
linda-f Jun 24, 2024
97924a6
fixed FavIcon link
Martin-Joensson Jun 24, 2024
87efe17
Merge branch 'main' of https://github.com/Izzibizz/project-final
Martin-Joensson Jun 24, 2024
211687f
adding aria-labels
linda-f Jun 25, 2024
7308ac1
fixing email and address validation in signup
linda-f Jun 25, 2024
d942bfb
fixing frontend to be the same as backend in validation
linda-f Jun 25, 2024
747d052
fixing email bug so user can only register with other email
linda-f Jun 25, 2024
4e2ef12
Merge pull request #55 from Izzibizz/emailval
linda-f Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Final Project
For Technigo Review: Be advised this is a page in progress. We have a functioning main branch with everything for the code review. But inside the code you will find unfinished or not connected components or pages we set up for future implementations. Also there are part in the backend which are not implemented in the frontend yet.

Replace this readme with your own information about your project.
# Final project

Start by briefly describing the assignment in a sentence or two. Keep it short and to the point.
This is the final project of our Web Development Bootcamp at Technigo.
We created an e-commerce website for skincare products. The special thing about our app is that users can specify their allergies and preferences. This way you get recommended products that suit you.
We worked in a group of three people and realised this project in 3 to 4 weeks, including planning and testing.

## The problem

Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next?
We started planning in Figma for the design and in Notion for the tasks. In the first week we worked separately in backend, frontend and Figma. From the second week onwards, we brought everything together. In the end, it was mainly about fixing bugs and testing everything. We will continue to work on this project and add more things in the coming months.

## View it live
## View live

Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about.
Here you can find the frontend: https://glim-skincare.netlify.app/
Here you can find the backend: https://project-final-glim.onrender.com

## Collaborators

[<img src="https://github.com/Martin-Joensson.png" width="80px;"/><br /><sub>Martin Jönsson</sub>](https://github.com/Martin-Joensson)

[<img src="https://github.com/Izzibizz.png" width="80px;"/><br /><sub>Izabel Lind Färnstrand</sub>](https://github.com/Izzibizz)

[<img src="https://github.com/linda-f.png" width="80px;"/><br /><sub>Linda Frischknecht</sub>](https://github.com/linda-f)
8 changes: 0 additions & 8 deletions backend/README.md

This file was deleted.

23 changes: 23 additions & 0 deletions backend/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import cors from "cors";
import express from "express";

//Import from seeding so that is runs
import seedDatabase from "./config/seeddatabase";
import documentationRoutes from "./routes/documentation";
import productsRoutes from "./routes/products";
import reviewRoutes from "./routes/reviews";
import stripeRoutes from "./routes/stripe";
import userRoutes from "./routes/users";

const app = express();

// Add middlewares to enable cors and json body parsing
app.use(cors("https://glim-skincare.netlify.app/"));
app.use(express.json());
app.use("/", documentationRoutes);
app.use("/products", productsRoutes);
app.use("/users", userRoutes);
app.use("/reviews", reviewRoutes);
app.use("/stripe", stripeRoutes);

export default app;
7 changes: 7 additions & 0 deletions backend/config/glimdatabase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import mongoose from "mongoose";

const mongoUrl = process.env.MONGO_URL || "mongodb://localhost/glim";
mongoose.connect(mongoUrl);
mongoose.Promise = Promise;

export default mongoose;
17 changes: 17 additions & 0 deletions backend/config/seeddatabase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import dotenv from "dotenv";

import { Product } from "../models/productSchema";

dotenv.config();

import productsData from "../data/productsfromAI.json";

if (process.env.RESET_DB === "true") {
const seedDatabase = async () => {
await Product.deleteMany({});
productsData.forEach((productData) => {
new Product(productData).save();
});
};
seedDatabase();
}
Loading