- Table of Contents 📑
- Introduction
- Technologies Used 🚀
- Requirements 📋
- Installation 🛠️
- Usage 🖲️
- Code Explanation 📚
- Link to WanToGo Final Project 👩💻
- Team 2 Section Medan 💡
- Contributing 🤝
- Show your support 💪
- Acknowledgments 🙏
- End 👋
Welcome to the WanToGo server-side repository! WanToGo is an online learning media platform dedicated to enhancing the skills and knowledge of users in various fields of education. We are part of Group 2 Section Medan RevoU MSIB KM AUG23, and we are proud to have designed and built this platform to provide travel book services to users.
WanToGo is built using various technologies, as follows:
This project requires the following:
And the following Node.js packages:
This project requires Node.js and npm (which comes with Node.js) to be installed on your machine.
Follow these steps to get the project set up:
- Clone the repository to your local machine. This can be done by running the following command in your terminal:
git clone <repository-url>
- Navigate to the project directory. This can be done by running the following command in your terminal:
cd <project-directory>
- Install the required packages. This project requires several Node.js packages, including
express
,cors
, anddotenv
. You can install all of them at once by running the following command in your terminal:
npm install
Once you've installed the project, you can start using it:
- Start the server. You can do this by running the
npm start
command:
npm start
This will start the server and log a message to the console indicating the URL where the server is running
- Set the server port. The server will start on the port specified in your .env file. If you haven't created this file yet, you'll need to do so in the project directory. The file should contain a line like this:
PORT=<your-port-number>
-
Use the
/book-ticket
endpoint to book a ticket. You can do this by sending a POST request tohttp://localhost:<your-port-number>/book-ticket.
-
Use the
/check-ticket
endpoint to check a ticket. You can do this by sending a GET request to http://localhost:/check-ticket/.
- Import Dependencies: The code starts by importing the necessary dependencies. These include
express
for building the server,cors
for handling Cross-Origin Resource Sharing, anddotenv
for managing environment variables.
const express = require("express");
const cors = require("cors");
require("dotenv").config();
- Setting up the Server: An Express application is created and the port number is retrieved from the environment variables.
const app = express();
const PORT = process.env.PORT;
- Middleware: The express.json() middleware is used to parse incoming requests with JSON payloads and the cors() middleware is used to enable CORS.
app.use(express.json());
app.use(cors());
- Import Routes: After setting up the middleware, the routes for booking and checking tickets are imported.
const bookTicketRoute = require("./src/routes/bookTicketRoute");
const checkTicketRoute = require("./src/routes/checkTicketRoute");
- Use Routes: The imported routes are then used with the appropriate endpoints.
app.use("/book-ticket", bookTicketRoute);
app.use("/check-ticket", checkTicketRoute);
- Start the Server: The server is started by calling the
app.listen()
method. The port number is passed as an argument to the method, and a callback function is passed as a second argument. The callback function logs a message to the console indicating the URL where the server is running.
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});
The server uses two routes: /book-ticket
and /check-ticket
. The code for these routes is imported from the src/routes
directory.
The server starts by calling app.listen()
, and logs a message to the console indicating the URL where the server is running.
Below is the link to the final project:
Website | Link | Description |
---|---|---|
WanToGo | Go to Website | Main WanToGo website link. |
WanToGo is a project built with concentration and great hope by Group 2 Section Medan KM AUG23, MSIB ( RevoU x MSIB Kemendikbudristek ).
Here are the designers and developers of WanToGo:
Name | Role |
---|---|
Stefanus Bernard Melkisedek | Project Leader |
Fajrina Reski Arini | Frontend Engineer |
Sherina Salsabila Dewi Beutari | Frontend Engineer |
Muhammad Ruskin Ridho | Backend Engineer |
Stefanus Bernard Melkisedek | Backend Engineer |
Rivianty Putri N | Quality Assurance |
Fadlila Nurwanda | Quality Assurance |
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Give a ⭐️ if you like this project!
We want to express our deepest appreciation to our instructors and mentor who have lectured and guided us to succeed in our project.
Our Instructors:
Our Mentor:
We also want to give a hat tip to anyone whose code was used as inspiration for this project.
Thank you for visiting the WanToGo repository and having fun using it. We hope you enjoy using WanToGo as much as we enjoy building it.