https://github.com/chuksjoshuaa/node-jobs-api
Jobs api built with Node Js, Mongodb, Express Js. It makes it easier for users to post different jobs application, users can update, delete each application.
https://github.com/chuksjoshuaa/node-jobs-api
error-handler expressjs http-status-codes middlewares mongodb mongoose nodejs swagger-ui
Last synced: 1 day ago
JSON representation
Jobs api built with Node Js, Mongodb, Express Js. It makes it easier for users to post different jobs application, users can update, delete each application.
- Host: GitHub
- URL: https://github.com/chuksjoshuaa/node-jobs-api
- Owner: ChuksJoshuaa
- Created: 2022-04-08T14:02:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-09T00:16:12.000Z (over 2 years ago)
- Last Synced: 2025-10-08T21:39:27.381Z (1 day ago)
- Topics: error-handler, expressjs, http-status-codes, middlewares, mongodb, mongoose, nodejs, swagger-ui
- Language: JavaScript
- Homepage:
- Size: 91.8 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
#### Setup
```bash
npm install && npm start
```#### Database Connection
1. Import connect.js..
2. Invoke in start()....
3. Setup .env in the root...
4. Add MONGO_URI with correct value...#### Routers
- auth.js
- jobs.js#### User Model
Email Validation Regex
```regex
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
```#### Register User
- Validate - name, email, password - with Mongoose...
- Hash Password (with bcryptjs)...
- Save User...
- Generate Token....
- Send Response with Token....#### Login User
- Validate - email, password - in controller...
- If email or password is missing, throw BadRequestError...
- Find User
- Compare Passwords
- If no user or password does not match, throw UnauthenticatedError
- If correct, generate Token
- Send Response with Token#### Mongoose Errors
- Validation Errors..
- Duplicate (Email)..
- Cast Error...#### Security
- helmet..
- cors...
- xss-clean...
- express-rate-limit...Swagger UI
```yaml
/jobs/{id}:
parameters:
- in: path
name: id
schema:
type: string
required: true
description: the job id
```