Skip to content

Commit

Permalink
Merge pull request #24 from Leave-it-blank/master
Browse files Browse the repository at this point in the history
test
  • Loading branch information
Mayank-Tripathi32 authored Aug 18, 2024
2 parents 69fedd6 + da025c8 commit 15730a7
Show file tree
Hide file tree
Showing 52 changed files with 2,628 additions and 3,214 deletions.
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
README.md
17 changes: 10 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
DB_HOST="mysql"#use localhost when using vscode enviornment
DB_NAME="mydb2"
DB_USER="root"
DB_PASSWORD="rootpass"
PORT= 3000
REDIS_HOST=<your Redis HOST>
REDIS_PORT=<your Redis PORT>
REDIS_PASSWORD=<your config PASSWORD>

REDIS_HOST="redis"#use localhost when using vscode enviornment
REDIS_PORT="22231"
REDIS_PASSWORD="qfawfraw awrarawr awrawrawr"

# This was inserted by `prisma init`:
# Environment variables declared in this file are automatically made available to Prisma.
Expand All @@ -10,10 +15,8 @@ REDIS_PASSWORD=<your config PASSWORD>
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings

DATABASE_URL="mysql://username:password$ilent@mydb2.amazon.ap-south-1.rds.amazonaws.com:3306/db_name"

# This is for JWT Authorization
DATABASE_URL="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:3306/${DB_NAME}"

JWTSECRET="mysecret"
JWTREFRESH_SECRET="mysecret secret secret"
SALT_PASS="a0we221q3$@#dad#"
SALT_PASS="a0we221q3$@#dad#"
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@
node_modules
# Dependency directories
node_modules/
builds/
data/
jspm_packages/

audit.*
docker/*
errors.log.*
# TypeScript v1 declaration files
typings/


# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm
.npm

access.log

src/access.log
/src/access.log
5 changes: 0 additions & 5 deletions .idea/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/Rest Api.iml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# Express API Starter
# Express Prisma Starter Template

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensrc.org/licenses/Apache-2.0)

How to use this template:
<img src="https://github.com/Leave-it-blank/Express-Starter-with-TS/blob/master/documentation/images/howtouse.jpg"/>

![alt text](https://github.com/Leave-it-blank/Express-Starter-with-TypeScript--Node--Redis--DotEnv/documentation/images/howtouse.jpg?raw=true)

Includes API Server utilities:
Includes API index utilities:

- [Prisma](https://www.npmjs.com/package/prisma)
- ORM for Mysql schema generation and manupulation
- [Cron](https://www.npmjs.com/package/node-cron)
- For Sheduling the jobs to run.
- [Redis](https://www.npmjs.com/package/redis)
- Caching solution for jwt refresh token
- [Mysql](https://www.npmjs.com/package/morgan)
- Database for storing data.
- [morgan](https://www.npmjs.com/package/morgan)
Expand All @@ -34,14 +31,17 @@ Development utilities:
- [Typescript](https://www.npmjs.com/package/typescript)
- For Tightly typing the codebase.


## Work in progress

- [Docker](https://www.npmjs.com/package/docker)
- Dockerize the whole application
- [jest](https://www.npmjs.com/package/jest)
- Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
- [supertest](https://www.npmjs.com/package/supertest)
- HTTP assertions made easy via superagent.
- [Docker](https://www.npmjs.com/package/docker)
- Dockerize the whole application
- [cors](https://www.npmjs.com/package/cors)
- Add cron job for cleaning up blacklisted tokens every 2 days.

## Setup

Expand All @@ -63,13 +63,13 @@ npm run dev

## Project layout

The code for the microservice is contained in the `source` directory. All of the test are in the `tests` folder(wip). The code follows the **Model-View-Controller** pattern with all of the database code and business logic in the controler dir, and all of the RESTful routing (`routes`) Dir which supports sub folder routing.
The code for the microservice is contained in the `src` directory. All of the test are in the `tests` folder(wip). The code follows the **Model-View-Controller** pattern with all of the database code and business logic in the controler dir, and all of the RESTful routing (`routes`) Dir which supports sub folder routing.

```text
├── documentation <- template documentation files
├── source <- microservice template
├── src <- microservice template
│   ├── controllers/ <- application controllers for routes <- microservice
│   ├── server.ts <- express configuration file
│   ├── index.ts <- express configuration file
│   ├── tests/ <- code for the testing various apis //wip
│   └── routes/ <- code for the REST API routes
├── tsconfig.json <- ts setup config
Expand All @@ -90,23 +90,30 @@ The User model contains the following fields:
| username | String(64) | False |
| email | String(64) | False |
| password | String(32) | False |
| api_key | String(32) | False |
| role | enum(role) | False |
| created_at | DateTime | auto |
| updated_at | DateTime | auto |
| deleted_at | DateTime | auto |

Role Enum
| Name | Optional |
| ---------- | -------- |
| USER | default |
| Subscriber | default |
| ADMIN | False |
| MANAGER | False |
#Note

Run
npx prisma migrate dev --name init
After updating database tables (ORM)

## Author

[Leave it Blank](https://github.com/Leave-it-blank/)

## Contributors

[Mizety](https://github.com/Mizety)

## License

Licensed under the Apache License. See [LICENSE](LICENSE)
29 changes: 0 additions & 29 deletions build/controllers/auth/authcontroller.js

This file was deleted.

29 changes: 0 additions & 29 deletions build/controllers/killcounter.js

This file was deleted.

12 changes: 0 additions & 12 deletions build/routes/api/authentication.js

This file was deleted.

12 changes: 0 additions & 12 deletions build/routes/killcounter.js

This file was deleted.

59 changes: 0 additions & 59 deletions build/server.js

This file was deleted.

Loading

0 comments on commit 15730a7

Please sign in to comment.