Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 12 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,33 @@ module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
// // Uncomment this and update according you needs
// overrides: [{
// files: [
// "cdk/**/*.ts"
// ],
// parserOptions: {
// "project": "cdk/tsconfig.json"
// },
// }],
};
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ lerna-debug.log*
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

.env
96 changes: 52 additions & 44 deletions README.md
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>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](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).
7 changes: 7 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
APP_PORT=4000

### These variables are needed to make script for getting access_token works
AUTH_USERNAME=yourGithubLogin ### It should be your github username
AUTH_PASSWORD=TEST_PASSWORD
APP_URL=http://localhost:4000
###
23 changes: 23 additions & 0 deletions get-token.sh
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\":\"$AUTH_USERNAME\",\"password\":\"$AUTH_PASSWORD\"}"
LOGIN_PAYLOAD="{\"username\":\"$AUTH_USERNAME\",\"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"
Loading