Table of Contents
Welcome to this API project ! I did not know what a backend could look like a few months ago, and I am so happy with this first project where I learned so much about server side, database, routes, and so on. Thanks to this project, I can now run a full stack Vinted replica project for both web and mobile apps. Please find my replicas for Vinted front-end projects here :
- Web project with React : https://github.com/LuonaMill/my-vinted-frontend
- Mobile project with React Native : https://github.com/LuonaMill/my-vinted-reactnative
- Platform : Node.js
- Framework : Express
- Database : MongoDB
- Pictures upload & storage : Cloudinary
- Payment : Stripe
To use this API you can request to the online API, hosted with Northflank : https://site--backend-vinted--wbbmf4gr4bwy.code.run/
- Clone the repo
git clone https://github.com/your_username_/Project-Name.git
- Install NPM packages
npm install
- Add your environment variables in a .env file with :
MONGODB_URI=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
SK_STRIPE=
PORT=
- Start server
npx nodemon
Create a new user
Body | Type | Required |
---|---|---|
email |
string | Yes |
password |
string | Yes |
username |
string | Yes |
phone |
string | No |
Log a user
Body | Type | Required |
---|---|---|
email |
string | Yes |
password |
string | Yes |
Receive a list of offers. Possibility to filter the results.
Query | Required | Description |
---|---|---|
title |
No | get a list of offers that contain title |
priceMin |
No | get offers above priceMin |
priceMax |
No | get offers below priceMax |
sort |
No | date-asc : get a list of offers sort by ascending dates date-desc : get a list of offers sort by descending dates price-asc : get a list of offers sort by ascending prices price-desc : get a list of offers sort by descending prices |
page |
No | set the results page |
limit |
No | set the limit of results |
Get an offer using its id
Param | Required | Description |
---|---|---|
id |
Yes | offer id |
Create a new offer
formData | Required | Description |
---|---|---|
title |
Yes | offer title |
picture |
Yes | product picture |
category |
Yes | product category |
price |
Yes | product price |
description |
No | product description |
brand |
No | product brand |
size |
No | product size |
condition |
No | product condition |
color |
No | offer color |
city |
No | the city in which the offer is located |
Headers | Required | Description |
---|---|---|
Bearer token |
Yes | user token |
Update an offer
Delete an offer
Get identified user's favorites
Param | Required | Description |
---|---|---|
userId |
Yes | user id |
Add an article to favorite
Body | Required | Description |
---|---|---|
offerId |
Yes | offer id |
userId |
Yes | user id |
Delete an article from favorites
Body | Required | Description |
---|---|---|
offerId |
Yes | offer id |
userId |
Yes | user id |
Handle payments through Stripe
Body | Type | Required |
---|---|---|
stripeToken |
string | Yes |