Skip to content

Coding example I'm using to teach Javascript API development (typescript, node, express, MongoDB, MERN Stack)

Notifications You must be signed in to change notification settings

ajtran303/instruments-express-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instruments REST API

Setup

Create a new Typescript / Express project TODO: Add MongoDB code examples

Initialize node, install dependencies, and configure settings

mkdir instruments
cd instruments
git init

npm init -y
npm i -D typescript ts-node nodemon @types/express @types/cors
npm i express cors mongodb dotenv

npx tsc --init

Create project files and directories

mkdir src
touch src/index.ts
touch src/db.ts

mkdir src/models
touch src/models/.keep

mkdir src/routes
touch src/routes/.keep

mkdir src/controllers
touch src/controllers/.keep

touch .env

Add .env and node_modules to .gitignore:

# in .gitignire

.env
node_modules/

Add npm scripts to package.json:

{
  //
  "scripts": {
  "start": "ts-node src/index.ts", 
  "start:dev": "nodemon src/index.ts"
  }
  //
}

Make initial commit

git add .
git commit -m 'Initial commit'

About

Coding example I'm using to teach Javascript API development (typescript, node, express, MongoDB, MERN Stack)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published