README
This commit is contained in:
parent
6b68ff1f22
commit
c6bc89ee2c
2 changed files with 17 additions and 36 deletions
48
README.md
48
README.md
|
@ -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"
|
||||
}
|
||||
## Installation
|
||||
|
||||
### Git ###
|
||||
clone the project and run `npm install` to install all the dependencies.
|
||||
|
||||
### typescript - ###
|
||||
run `tsc` to compile the typescript files to javascript.
|
||||
or
|
||||
run `npm run build` to compile the typescript files to javascript.
|
||||
|
||||
install pg MacOS -
|
||||
Install Homebrew -
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
### Server ###
|
||||
run `npm run dev` to start the server in development mode.
|
||||
|
||||
Install Postgres -
|
||||
brew install postgresql
|
||||
### Database ###
|
||||
run `npm run migrate` to create the database tables.
|
||||
run `npm run seed` to seed the database with some data.
|
||||
|
||||
Start Postgres -
|
||||
brew services start postgresql
|
||||
|
||||
Postgres CLI -
|
||||
psql postgres
|
||||
|
||||
init POSTGRES Database -
|
||||
CREATE DATABASE drop_shopping;
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
knex for migration files
|
||||
npx knex migrate:make create_addresses_table
|
||||
npx knex migrate:latest --env development
|
||||
npx knex migrate:rollback --env development
|
|
@ -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": "",
|
||||
|
|
Loading…
Reference in a new issue