https://github.com/espiramarvin/events-api
https://github.com/espiramarvin/events-api
aws-elastic-beanstalk expessjs nodejs
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/espiramarvin/events-api
- Owner: EspiraMarvin
- Created: 2022-10-28T10:18:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-23T15:44:51.000Z (over 3 years ago)
- Last Synced: 2025-03-28T17:18:31.150Z (about 1 year ago)
- Topics: aws-elastic-beanstalk, expessjs, nodejs
- Language: JavaScript
- Homepage:
- Size: 50.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## EXPRESS BACKEND
###### events api
### TIPS USED while doing this project
1. JSON WEB TOKEN & SECURITY
- Issues Access Token and Refresh Token
- Access token = short time to expire
- Refresh token = long time to expire
- Client stores access token in memory and NOT in local storage or cookies
> (If you can store tokens with javascript (in localstorage and cookies) a hacker can also retrieve it with javascript)
- The REST API are issued with a `httpOnly cookie`
> this cookie cannot be accessed with javascript
- Refresh token should have an expiration, which then require a user to login again
- Refresh tokens should not have the ability to issue new refresh tokens because that will grant indefinite access. - they should also be able to expire
- Acess token is issued after user authentication
- New token is issued at Refresh request
2. To generate random access and refresh tokens with node for our env access token
> > > >
open terminal
type node, hit enter
type require('crypto').randomBytes(64).toString('hex')
----------------------
output something like below
21e47046cc77b371fa56b4d840ebdsfsdfskdfl2bfa1de67e9cae6ff77d1d084cf1efed3c2c0d5a1a93ceadd7e6d76da527027f9278a794e166487e306afe527a7f4
> > > >
###### Migrate scraped data into mongocloud
> mongoimport --uri mongodb+srv://:@cluster0.7tbkbvy.mongodb.net/ --collection --type json --file --jsonArray