This is a Node.js API server that provides user authentication with JWT and serves data from YAML files.
- User authentication with JWT
- Dynamic API routes based on YAML files in the
apis
directory - Data from YAML files is served as JSON
- Install Node.js and npm.
- Clone this repository.
- Run
npm install
to install the dependencies. - Create a
users.json
file with your user data in theconfigs
directory. - Create a
secret_key
file with your JWT secret key in theconfigs
directory. - Put your YAML files in the
apis
directory.
- Run
node app.js
to start the server. - Send a POST request to
/login
with your username and password to get a JWT. - Send a GET request to an API route with the
Authorization: Bearer <token>
header to get the data from the corresponding YAML file.