Skip to content

How to handle data schemas #15

Answered by canmingir
CanPacis asked this question in Q&A
Discussion options

You must be logged in to vote

I am glad that you opened this up in discussions because we are still designing the runtime, in current stage, we are working to integrate with OpenAPI here. By the design, when it gets the JavaScript part, data will be already validated according the defined API, and for all of business logic and constraint logic, it is just the pure JavaScript, like for your example, unique constraint, it is going to be look like this:

app.post("/users", (req) => {
  const username = req.body.username
    
  if(User[username]) {
    throw "USER_ALREADY_REGISTERED"
  }

  return new User(req.body.username)
});

The way that Nucleoid works is like the runtime rerenders JavaScript is passed by, manages cont…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CanPacis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants