This repository contains the backend code for a web application, providing various API endpoints. The application is built using Express, TypeScript, MongoDB, and other related technologies.
- Installation
- Usage
- API Endpoints
- Project Structure
- Configuration
- Scripts
- Dependencies
- Development Dependencies
- License
- Author
- Repository
1.Clone the repository from GitHub:
git clone https://github.com/integration-tech/backend.git
2.Install dependencies:
npm install
3.Create a .env file
in the root directory and set the required environment variables. Refer to the .env.example
file for reference.
To start the server, run the following command:
npm start
This will start the server at http://localhost:8001/.
For development with automatic restart on code changes, you can use:
npm run dev
-
GET /:
- Returns a simple "Hello World!" message.
-
POST /register:
- Registers a user.
-
GET /student-details:
- Retrieves student details.
- src/: Contains the source code.
- api/v1/:
- controllers/: Contains controller logic for different routes.
- models/: Defines MongoDB models.
- routers/: Defines API routes using Express Router.
- index.ts: Entry point of the application.
- api/v1/:
The application uses the dotenv
library for environment variable configuration. Create a .env
file in the root directory with the following variables:
MONGODB_URI=<your_mongodb_uri>
JWT_SECRET=<your_jwt_secret>
PORT=8001
- npm start: Start the server using
ts-node.
- npm run build: Build the TypeScript code using
tsc.
- npm run dev: Start the server in development mode using
nodemon.
- Express: Web framework for Node.js.
- Mongoose: MongoDB object modeling tool.
- jsonwebtoken: JSON Web Token (JWT) implementation.
- dotenv: Loads environment variables from a
.env file.
- body-parser: Middleware to parse incoming request bodies.
- typescript: TypeScript compiler.
- ts-node: TypeScript execution environment for Node.js.
- nodemon: Monitor for changes and automatically restart the server.
This project is licensed under the MIT License - see the LICENSE file for details.