Skip to content

Instantly share code, notes, and snippets.

@navanathjadhav
Last active November 12, 2020 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navanathjadhav/c7a22ff60ded9a51d91f2226622f25aa to your computer and use it in GitHub Desktop.
Save navanathjadhav/c7a22ff60ded9a51d91f2226622f25aa to your computer and use it in GitHub Desktop.
Mock server API with students data
/*
* Mock students data
*/
const students = [
{ name: "Alice Doe", email: "alice@xyz.com", department: "Computer Science" },
{
name: "John Doe",
email: "john@xyz.com",
department: "Information Technology",
},
{ name: "Alice Doe", email: "alice@xyz.com", department: "Computer Science" },
{
name: "John Doe",
email: "john@xyz.com",
department: "Information Technology",
}
];
/*
* Get students
*/
app.get("/api/students", (req, res) => {
// Artificial delay for showing loader in client
setTimeout(() => {
res.status(200).json(students);
}, 2000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment