forked from boale/rs-cart-api
-
Notifications
You must be signed in to change notification settings - Fork 138
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
Frontend integration #25
Merged
apalchys
merged 19 commits into
rolling-scopes-school:main
from
AlexanderSUS:regulal-server
Dec 29, 2024
Merged
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
cac650c
build: fix eslint
AlexanderSUS 1a29ca2
fix: cart.service, remove unused deps
AlexanderSUS 6db8e3d
fix: auth, user and cart controllers to fit fronttend
AlexanderSUS 2b2a17e
feat: updaate order feature
AlexanderSUS afa756f
fix: authorization
AlexanderSUS 454636d
fix: authorization
AlexanderSUS 8b62ef9
build: update scripts
AlexanderSUS c4b32bb
style: comment temporary unused eslint code block
AlexanderSUS 9f91a3e
chore: add defautl port and fix status code
AlexanderSUS 334cadd
refactor: remove js doc declaration
AlexanderSUS c6ff1e3
test: add e2e tests to app module
AlexanderSUS 2b661ef
docs: update README.md
AlexanderSUS 6b70118
refactor: User type
AlexanderSUS 458455b
refactor: types
AlexanderSUS c2fc40f
refactor: add type and remove comment
AlexanderSUS b115de2
chore: update bash script
AlexanderSUS 72ef2d0
refactor: README.md
AlexanderSUS 74634f4
refactor: minor fixes
AlexanderSUS 6f10239
test: fix and update e2e tests
AlexanderSUS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ lerna-debug.log* | |
.elasticbeanstalk/* | ||
!.elasticbeanstalk/*.cfg.yml | ||
!.elasticbeanstalk/*.global.yml | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,83 @@ | ||
<p align="center"> | ||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a> | ||
</p> | ||
|
||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master | ||
[travis-url]: https://travis-ci.org/nestjs/nest | ||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux | ||
[linux-url]: https://travis-ci.org/nestjs/nest | ||
|
||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p> | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a> | ||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a> | ||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a> | ||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a> | ||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a> | ||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a> | ||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a> | ||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a> | ||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a> | ||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a> | ||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a> | ||
</p> | ||
<!--[](https://opencollective.com/nest#backer) | ||
[](https://opencollective.com/nest#sponsor)--> | ||
|
||
## Description | ||
|
||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. | ||
# nodejs-aws-cart-api | ||
|
||
## Installation | ||
|
||
```bash | ||
$ npm install | ||
npm install | ||
``` | ||
|
||
|
||
|
||
## Running the app | ||
|
||
```bash | ||
# development | ||
$ npm run start | ||
npm run start | ||
|
||
# watch mode | ||
$ npm run start:dev | ||
npm run start:dev | ||
|
||
# production mode | ||
$ npm run start:prod | ||
npm run start:prod | ||
``` | ||
|
||
|
||
## Test | ||
|
||
```bash | ||
# unit tests | ||
$ npm run test | ||
npm run test | ||
|
||
# e2e tests | ||
$ npm run test:e2e | ||
npm run test:e2e | ||
|
||
# test coverage | ||
$ npm run test:cov | ||
npm run test:cov | ||
``` | ||
|
||
### Create user and get auth token | ||
|
||
register user with `POST` http://localhost:4000/api/auth/register | ||
|
||
Body: | ||
```json | ||
{ | ||
"name": "your_github_login", | ||
"password": "TEST_PASSWORD" | ||
} | ||
``` | ||
|
||
## Support | ||
**get token** with `POST` http://localhost:4000/api/auth/login | ||
|
||
Body | ||
```json | ||
{ | ||
"username": "your_github_login", | ||
"password": "TEST_PASSWORD" | ||
} | ||
``` | ||
Response | ||
```json | ||
{ | ||
"token_type": "Basic", | ||
"access_token": "eW91ckdpdGh1YkxvZ2luOlRFU1RfUEFTU1dPUkQ=" | ||
} | ||
|
||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). | ||
``` | ||
|
||
## Stay in touch | ||
**Or you can do it with bash script, make sure you have installed `curl` in your system** | ||
|
||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) | ||
- Website - [https://nestjs.com](https://nestjs.com/) | ||
- Twitter - [@nestframework](https://twitter.com/nestframework) | ||
Put content of env.example to .env and update credentials: | ||
```bash | ||
cat env.example > .env | ||
``` | ||
|
||
## License | ||
Create user and get token | ||
```bash | ||
./get-token.sh | ||
``` | ||
if command failed make script executable | ||
```bash | ||
chmod +x ./get-token.sh | ||
``` | ||
|
||
Nest is [MIT licensed](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
APP_PORT=4000 | ||
|
||
APP_URL=http://localhost:4000 | ||
|
||
GITHUB_ACCOUNT_LOGIN=yourGithubLogin | ||
AUTH_PASSWORD=TEST_PASSWORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
if [ ! -f .env ]; then | ||
echo ".env file does not exist. Run command:" | ||
echo "cat env.example > .env" | ||
echo "Then update credentials in created .env file" | ||
exit 1 | ||
fi | ||
|
||
source .env | ||
|
||
|
||
REGISTER_PAYLOAD="{\"name\":\"$GITHUB_ACCOUNT_LOGIN\",\"password\":\"$AUTH_PASSWORD\"}" | ||
LOGIN_PAYLOAD="{\"username\":\"$GITHUB_ACCOUNT_LOGIN\",\"password\":\"$AUTH_PASSWORD\"}" | ||
|
||
curl -s --header "Content-Type: application/json" \ | ||
--request POST \ | ||
--data "$REGISTER_PAYLOAD" "$APP_URL/api/auth/register" > /dev/null | ||
|
||
|
||
curl -s --header "Content-Type: application/json" \ | ||
--request POST \ | ||
--data "$LOGIN_PAYLOAD" "$APP_URL/api/auth/login" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to name
AUTH_USERNAME
and add a comment, it should be your GitHub username.I also suggest to group
APP_URL
,AUTH_USERNAME
andAUTH_PASSWORD
together with a comment, they are needed to make the script work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done