Compare commits
6 commits
e44d9f0b6f
...
349ba54b13
Author | SHA1 | Date | |
---|---|---|---|
349ba54b13 | |||
609506fdaf | |||
5ef3a77210 | |||
7bcbe81262 | |||
ae3e0c6e2c | |||
d12e2581b6 |
2 changed files with 2 additions and 100 deletions
98
README.md
98
README.md
|
@ -1,98 +0,0 @@
|
|||
# Ecomm #
|
||||
|
||||
## Description ##
|
||||
This is a simple e-commerce backend application.
|
||||
|
||||
Technologies used:
|
||||
|
||||
* Node.js
|
||||
* typescript
|
||||
* Express.js
|
||||
* MongoDB
|
||||
* Mongoose ORM
|
||||
* Docker (docker-compose)
|
||||
* bcrypt
|
||||
* JWT
|
||||
|
||||
## How to run ##
|
||||
1. Clone the repository
|
||||
2. Make sure you have docker and docker-compose installed
|
||||
3. Implement the .env file
|
||||
4. Run `docker-compose up` in the root directory
|
||||
The application will be running on port 3000
|
||||
The database will be running on port 27017
|
||||
|
||||
## API ##
|
||||
app.use('/products', productRouter);
|
||||
app.use('/cart', cartRouter);
|
||||
|
||||
# Users #
|
||||
## POST /users ## - Create a new user
|
||||
### Request body ###
|
||||
```json
|
||||
{
|
||||
"name": "string",
|
||||
"email": "string",
|
||||
"password": "string"
|
||||
}
|
||||
```
|
||||
### Response body ###
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"_id": "string",
|
||||
"name": "string",
|
||||
"email": "string",
|
||||
"password": "string",
|
||||
"createdAt": "string",
|
||||
"updatedAt": "string",
|
||||
"__v": "number"
|
||||
},
|
||||
"token": "string"
|
||||
}
|
||||
```
|
||||
## POST /users/login ## - Login
|
||||
### Request body ###
|
||||
```json
|
||||
{
|
||||
"email": "string",
|
||||
"password": "string"
|
||||
}
|
||||
```
|
||||
### Response ###
|
||||
# body #
|
||||
```json
|
||||
{
|
||||
"access-token": "string"
|
||||
}
|
||||
```
|
||||
# headers #
|
||||
``` Cookie - "access-token"": "string" ```
|
||||
|
||||
|
||||
# Products #
|
||||
## GET /products ## - Get all products
|
||||
accepts query params: page, limit. Default values: page = 0, limit = 50.
|
||||
### Response body ###
|
||||
```json
|
||||
{
|
||||
"products": [
|
||||
{
|
||||
"_id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"price": "number",
|
||||
"createdAt": "string",
|
||||
"updatedAt": "string",
|
||||
"__v": "number"
|
||||
}
|
||||
],
|
||||
"total": "number"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
"scripts": {
|
||||
"dev": "nodemon dist/index.js",
|
||||
"start": "node dist/index.js",
|
||||
"build": "tsc -p ."
|
||||
},
|
||||
"build": "tsc -p ."
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Reference in a new issue