This is a simple API that saves user information.
Install global TypeScript and TypeScript Node
npm install -g typescript ts-node
You should install MongoDB on your local machine, or use other services such as mLab or Compose
After that, you will have to replace the mongoURL with your MongoDB address in server/app.ts
git clone https://github.com/h4mit/express.ts.git .
Then install the dependencies
npm install or npm i
Run in development mode
npm run dev
Run in production mode
npm run prod
The default URL is: http://127.0.0.1:3000/users
-
GET all users
-
Post register new user https://127.0.0.1:3000/user
{
"username": "h4mit",
"firstName": "Hamid",
"lastName": "Taheri",
"email": "[email protected]",
"password": "h4mith4mit",
"role": "admin",
"permissions": ["REPORT", "EDIT_USER"]
}
Send GET request to https://127.0.0.1:3000/users/
The default URL is: https://127.0.0.1:3000
The key and cert in the config folder is for testing purpose only. You should generate your own.
Reference from Lynda.com