generated from trywilco/Anythink-Market-Public
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
WilcoApp
committed
Jan 24, 2024
1 parent
9415519
commit ec1cc2f
Showing
116 changed files
with
41,995 additions
and
20,163 deletions.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
env: { | ||
node: true, | ||
}, | ||
root: true, | ||
parser: "@typescript-eslint/parser", | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
], | ||
ignorePatterns: ["dist/", "node_modules/"], | ||
plugins: ["@typescript-eslint", "jest"], | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
}, | ||
rules: { | ||
"@typescript-eslint/no-var-requires": 0, | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ | ||
varsIgnorePattern: "^_", | ||
argsIgnorePattern: "^_", | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["test/**/*.ts"], | ||
}, | ||
], | ||
}; |
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 |
---|---|---|
|
@@ -35,3 +35,7 @@ node_modules | |
.node_repl_history | ||
|
||
.idea | ||
|
||
dist | ||
|
||
.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dist/ | ||
package.json | ||
package-lock.json | ||
tsconfig.json |
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 +1,8 @@ | ||
FROM public.ecr.aws/v0a2l7y2/wilco/anythink-backend-node:latest | ||
FROM node:18 | ||
|
||
RUN curl https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh --output /wait-for-it.sh | ||
|
||
RUN chmod +x /wait-for-it.sh | ||
|
||
WORKDIR /usr/src/backend | ||
RUN yarn install |
This file was deleted.
Oops, something went wrong.
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,22 +1,3 @@ | ||
# Anythink Market Backend | ||
# Mongo Chat Server | ||
|
||
The Anythink Market backend is Node web app written with [Express](https://expressjs.com/) | ||
|
||
## Dependencies | ||
|
||
- [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) - For generating JWTs used by authentication | ||
- [mongoose](https://github.com/Automattic/mongoose) - For modeling and mapping MongoDB data to javascript | ||
- [mongoose-unique-validator](https://github.com/blakehaswell/mongoose-unique-validator) - For handling unique validation errors in Mongoose. Mongoose only handles validation at the document level, so a unique index across a collection will throw an exception at the driver level. The `mongoose-unique-validator` plugin helps us by formatting the error like a normal mongoose `ValidationError`. | ||
- [passport](https://github.com/jaredhanson/passport) - For handling user authentication | ||
- [slug](https://github.com/dodo/node-slug) - For encoding titles into a URL-friendly format | ||
|
||
## Application Structure | ||
|
||
- `app.js` - The entry point to our application. This file defines our express server and connects it to MongoDB using mongoose. It also requires the routes and models we'll be using in the application. | ||
- `config/` - This folder contains configuration for passport as well as a central location for configuration/environment variables. | ||
- `routes/` - This folder contains the route definitions for our API. | ||
- `models/` - This folder contains the schema definitions for our Mongoose models. | ||
|
||
## Error Handling | ||
|
||
In `routes/api/index.js`, we define a error-handling middleware for handling Mongoose's `ValidationError`. This middleware will respond with a 422 status code and format the response to have [error messages the clients can understand](https://github.com/gothinkster/realworld/blob/master/API.md#errors-and-status-codes) | ||
Based on https://mongodb.github.io/chatbot/server/configure |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.