https://github.com/sandylib/node-typescript-api-starter
node-auentication-api
https://github.com/sandylib/node-typescript-api-starter
express expressjs node node-authentication-api typescript
Last synced: about 2 months ago
JSON representation
node-auentication-api
- Host: GitHub
- URL: https://github.com/sandylib/node-typescript-api-starter
- Owner: sandylib
- Created: 2020-01-30T00:57:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T01:17:09.000Z (over 3 years ago)
- Last Synced: 2025-03-16T08:14:54.977Z (over 1 year ago)
- Topics: express, expressjs, node, node-authentication-api, typescript
- Language: JavaScript
- Size: 7.8 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 28
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# steps for running it up
## install packages should be separate for client and api.
### `cd api ` run `npm install`
### `cd client ` run `npm install`
## running api has denpendence with mongodb and redis, requires docker installed in your local machine
### in the root of your project run `npm run up` will up mongodb, redis and api server
## running client react app authentication
### `cd client` run `npm install`
# if you are lost, here is the youtube link:
https://www.youtube.com/watch?v=Ujk3emNC6L0
# node-auth
## curl
```sh
curl -v localhost:3000/api/v1/home --cookie 'sid=s%3A_zHhKduFB-uggbg8vEJ4XlZoAlsDkRdT.nE%2FxxAvYDuBg22wJ%2BO7A8evKnrUllgg3Ar7gJq9NhEY'
curl POST localhost:3000/api/v1/login -H 'Content-Type: application/json' \
-d '{"email": "sandy@gmail.com", "password": "Secret12"}'
curl -v -X POST localhost:3000/api/v1/register -H 'Content-Type: application/json' \
-d '{"email": "sandy@gmail.com", "name": "sandy", "password": "Secret12", "passwordConfirmation": "Secret12"}'
curl -v -X POST localhost:3000/api/v1/register -H 'Content-Type: application/json' \
--cookie 'sid=s%3ACuKP7VRYH1IRgG_jq_RP6daWnPPPYyhd.X0ErxoIqbgqLkW3wmO4QnTvxp55YDFafwKNJ%2Bmt5m0Y'
```
## docker command
```sh
docker exec -it node-au_db_1 mongo -u admin -p secret auth
docker exec -it node-au_cache_1 redis-cli -a secret
scan 0
// to see the session infomation
get "sess:CuKP7VRYH1IRgG_jq_RP6daWnPPPYyhd"
// to see session expired time
ttl "sess:CuKP7VRYH1IRgG_jq_RP6daWnPPPYyhd"
```
### mongo
```sh
//query
db.users.find({}).pretty()
//delete
db.users.deleteMany({})
```