This commit is contained in:
Kfir Dayan 2023-04-26 21:01:49 +03:00
parent 6b68ff1f22
commit c6bc89ee2c
2 changed files with 17 additions and 36 deletions

View file

@ -1,41 +1,21 @@
# DropIt Example Project #
examples -
Delivery System using Nodejs [Typescript], Express, axios, knex, pg (not implemented yet), in-memory caching.
POST localhost:3000/resolve-address
{
"searchTerm": "38%20Upper%20Montagu%20Street%2C%20London%20W1H%201LJ%2C%20United%20Kingdom"
}
install pg MacOS -
Install Homebrew -
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install Postgres -
brew install postgresql
## Installation
Start Postgres -
brew services start postgresql
Postgres CLI -
psql postgres
### Git ###
clone the project and run `npm install` to install all the dependencies.
init POSTGRES Database -
CREATE DATABASE drop_shopping;
### typescript - ###
run `tsc` to compile the typescript files to javascript.
or
run `npm run build` to compile the typescript files to javascript.
create tables -
CREATE TABLE deliveries (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL,
slot_id INTEGER NOT NULL,
delivery_date DATE NOT NULL,
address TEXT NOT NULL,
status VARCHAR(10) NOT NULL
);
### Server ###
run `npm run dev` to start the server in development mode.
knex for migration files
npx knex migrate:make create_addresses_table
npx knex migrate:latest --env development
npx knex migrate:rollback --env development
### Database ###
run `npm run migrate` to create the database tables.
run `npm run seed` to seed the database with some data.

View file

@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "nodemon dist/index.js"
"dev": "nodemon dist/index.js",
"build": "npx tsc"
},
"keywords": [],
"author": "",