A secured API based on Express written in Typescript, powered by Webpack and mapped with Swagger.
Other features: MongoDB connection, Multi-languages, Encryption, Mocha-Chai test.
environment: dev,
database:
path: mongodb://127.0.0.1:27017/
db: hello
collections:
test: test,
users: users
passwords: passwords
tokens: tokens
token:
secret: top-secret-token
expiration: 7
api:
port: 3000
version: 1
path: /api/1
encryption:
binary: base64
algorithm: aes192
hash: sha512
iterations: 16
language: EN_US
- Public
- username: public
- password: public
- role: 0
- Member
- username: member
- password: member
- role: 1
- Manager
- username: manager
- password: manager
- role: 2
- Admin
- username: admin
- password: admin
- role: 3
GET / redirection to /[APIVersion]/
GET /api-docs (dev. env. only) swagger UI
POST /[APIVersion]/signin signin
POST /[APIVersion]/login login
POST /[APIVersion]/check-token check token
ALL /[APIVersion]/member/* member role validation
POST /[APIVersion]/member/profile get member profile
POST /[APIVersion]/member/update update member profile
POST /[APIVersion]/member/delete delete member profile
ALL /[APIVersion]/manager/* manager role validation
ALL /[APIVersion]/admin/* admin role validation
POST /[APIVersion]/admin/users get all users
POST /[APIVersion]/admin/user get an user
POST /[APIVersion]/admin/user/create create an user
POST /[APIVersion]/admin/user/update update an user
POST /[APIVersion]/admin/user/delete delete an user
git clone https://github.com/tocausan/express-api-ts.git
cd express-api-ts
npm install
# don't forget to start mongodb services
# test
npm test
# start
npm build
npm start
# dev
npm run dev