-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
DATABASE_URL="mongodb+srv://Youssef:[email protected]/dev" | ||
SENTRY_DSN="https://[email protected]/6151641" | ||
APP_HOSTNAME="localhost" | ||
ADMIN_SECRET_KEY="U3yzmdukuSZtqdn" | ||
MANAGER_SECRET_KEY="N2Dj6pjxa2mJx7z" | ||
DELIVERYMANAGER_SECRET_KEY="EgJcSpYz1MyBKok" | ||
DRIVER_SECRET_KEY="iLIlVrLsXkiTskg" | ||
PORT=3000 | ||
EMAIL="[email protected]" | ||
PASSWORD="SafiAIrline@123" | ||
APP_URL=http://localhost:3000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x, 16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "yarn" | ||
heroku_api_key: ${{secrets.HEROKU_API_KEY}} | ||
heroku_app_name: ${{secrets.HEROKU_APP_NAME}} | ||
heroku_email: ${{secrets.HEROKU_EMAIL}} | ||
- run: yarn | ||
- run: yarn build |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,3 @@ node_modules/ | |
*.env* | ||
!.env.example | ||
!migrations/ | ||
Dockerfile | ||
docker-compose.yml | ||
.dockerignore |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json ./ | ||
|
||
COPY yarn.lock ./ | ||
|
||
RUN yarn install --frozen-lockfile | ||
|
||
COPY . . |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Alex N | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,110 @@ | ||
# delivery_api | ||
# MarocShip-Delivery | ||
|
||
MarocShip wishes to facilitate delivery management with partner e-commerce sites by creating a Rest API | ||
|
||
# Environment vars | ||
|
||
This project uses the following environment variables: | ||
|
||
| Name | Description | | ||
| -------------------------- | ------------------------------------------------ | | ||
| SENTRY_DSN | [Sentry](https://docs.sentry.io/platforms/node/) | | ||
| ADMIN_SECRET_KEY | Random key for jwt | | ||
| ADMIN_SECRET_KEY | Random key for jwt | | ||
| MANAGER_SECRET_KEY | Random key for jwt | | ||
| DELIVERYMANAGER_SECRET_KEY | Random key for jwt | | ||
| DRIVER_SECRET_KEY | Random key for jwt | | ||
| EMAIL | Your email for sending emails | | ||
| PASSWORD | Password for email | | ||
| APP_HOSTNAME | Application Hostname | | ||
| APP_URL | Application URL | | ||
|
||
> You can use [Random Password Generator](https://www.avast.com/random-password-generator) | ||
# Pre-requisites | ||
|
||
- Install [Node.js](https://nodejs.org/en/) version 14.X.X | ||
|
||
# Getting started | ||
|
||
- Clone the repository | ||
|
||
``` | ||
git clone https://github.com/YounessHassoune/delivery_api.git | ||
``` | ||
|
||
- Install dependencies | ||
|
||
``` | ||
cd MarocShip-Delivery | ||
yarn install | ||
``` | ||
|
||
- Build the project | ||
|
||
``` | ||
yarn build | ||
``` | ||
|
||
- Run the project | ||
|
||
``` | ||
yarn start:dev | ||
``` | ||
|
||
- Kill the servers | ||
|
||
``` | ||
yarn kill | ||
``` | ||
|
||
## API Reference | ||
|
||
#### Check the postman folder | ||
|
||
[need help ?](https://learning.postman.com/docs/getting-started/importing-and-exporting-data/) | ||
|
||
# TypeScript + Node | ||
|
||
The main purpose of this repository is to show a project setup and workflow for writing microservice. The Rest APIs will be using the Swagger (OpenAPI) Specification. | ||
|
||
## Project Structure | ||
|
||
The folder structure of this app is explained below: | ||
|
||
| Name | Description | | ||
| -------------------- | -------------------------------------------------------------------------------------------------------- | | ||
| **.github/workflow** | Contains github actions allows you to automate your build, test, and deployment pipeline | | ||
| **build** | Contains the distributable (or output) from your TypeScript build. | | ||
| **src** | Contains source code that will be compiled to the dist dir | | ||
| **test** | Contains all individual units/components are tested in isolation | | ||
| **src/server.ts** | Entry point to express app | | ||
| **src/config** | Application configuration including environment-specific configs | | ||
| **src/controllers** | Controllers define functions to serve various express routes. | | ||
| **src/lib** | Common libraries to be used across your app. | | ||
| **src/middlewares** | Express middlewares which process the incoming requests before handling them down to the routes | | ||
| **src/routes** | Contain all express routes, separated by module/area of application | | ||
| **src/models** | Models define schemas that will be used in storing and retrieving data from Application database | | ||
| **src/utils** | specific functions used throughout the App | | ||
| Dockerfile | Docker file for Build the app’s container image | | ||
| ecosystem.config.js | managing multiple applications with [PM2](https://pm2.keymetrics.io/docs/usage/application-declaration/) | | ||
| tsconfig.json | Configuring TypeScript compilation | | ||
|
||
### Scripts | ||
|
||
All the different build steps are orchestrated via [yarn scripts](https://classic.yarnpkg.com/lang/en/docs/cli/run/). | ||
Yarn scripts basically allow us to call (and chain) terminal commands via yarn. | ||
|
||
| Yarn Script | Description | | ||
| ----------- | ------------------------------------------------------------------------------- | | ||
| `start:dev` | Runs node on build/server.js | | ||
| `build` | Full build. Runs ALL build tasks | | ||
| `dev` | Runs full build before starting all watch tasks. Can be invoked with `yarn dev` | | ||
| `test` | run units tests using [jest](https://jestjs.io/) | | ||
| `kill` | stop servers | | ||
| `monit` | monitor the resource usage of your application | | ||
|
||
## Authors | ||
|
||
- [@Youssef Hajjari](https://twitter.com/Yosufuu) | ||
- [@Youness Hassoune](https://twitter.com/YounessHassoune) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.